On 12/07/07 15:12, Rene Buergel wrote:
I'm currently playing around using mainline with the variadic template
feature and would like to hear some comments on code gcc is rejecting.
#1:
=====
1 template<typename T, T a, T... Args> T max()
2 {
3 return a > max<T, Args>() ? a : max<T, Args>();
4 };
5
6 template<typename T, T a, T b>T max()
7 {
8 return a > b ? a : b;
9 };
int main()
{
unsigned int a = max<unsigned int, 3, 2>();
unsigned int a = max<unsigned int, 3, 2, 5>();
}
=====
Using the non-variadic template, everything works fine. With the
variadic templates, gcc issues an error in line 3:
error: parameter packs not expanded with `...':
note: 'Args'
[snip]
I think this is an instance of bug 40092:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40092
A 1 line patch to gcc/cp/tree.c has been proposed there.
You might try the patch an see if it solves your problem.
-regards,
Larry