g++ template value parameter / partial specialization bug
Jens Maurer
jmaurer@menuett.rhein-main.de
Wed Feb 23 03:11:00 GMT 2000
Hello,
I tried to compile the enclosed program with
gcc version 2.95.2 19991024 (release)
gcc version 2.96 20000221 (experimental)
on Linux kernel 2.2.13, glibc 2.1.2.
The error message was in both cases
value-partial-special.cc: In function `int main()':
value-partial-special.cc:14: no method `X<int,5,true>::doit'
Obviously, the compiler does not use the partial specialization
provided and thus fails to find the method doit().
Leaving out the "IntType x" template value parameter makes the
example compile.
Jens Maurer.
// leave out the "IntType x" template value parameter and it works.
template<class IntType, IntType x, bool v>
struct X;
template<class IntType, IntType x>
struct X<IntType, x, true>
{
static void doit() { }
};
int main()
{
X<int, 5, true>::doit();
}
More information about the Gcc-bugs
mailing list