Template bug: address of non-static class member as template argument
tveldhui@cs.indiana.edu
tveldhui@cs.indiana.edu
Thu Sep 3 14:22:00 GMT 1998
This test case should fail, but compiles under egcs 1.1a:
// [temp.arg.nontype.3] Addresses of array elements and names or
// addresses of non-static class members are not acceptable template-
// arguments.
template<int* i> class X { };
struct S {
static int i;
} s;
X<&s.i> z; // Error: S::i must be used
int main() { return 0; }
This test case should also fail:
template<int* i> class X { };
struct S {
int i;
} s;
X<&s.i> z;
int main() { return 0; }
More information about the Gcc-bugs
mailing list