Possible Duplicate:
GCC error with variadic templates: “Sorry, unimplemented: cannot expand 'Identifier…' into a fixed-length argument list”
I have this code, and it produces the error message shown in the title:
#include <iostream>
template <int FIRST, int... NEXT>
struct Test {
static const int VALUE = FIRST + Test<NEXT...>::VALUE;
};
template <int FIRST>
struct Test<FIRST> {
static const int VALUE = FIRST;
};
int main() {
std::cout << Test<1, 2, 3>::VALUE << std::endl; // print "6"
return 0;
}
Is there any simple workaround that will make it compile in GCC without changing what it does?