egcs won't allow constant expression as template argument of kind "pointer type"

John Hackworth zooko@wildgoose.tandu.com
Wed Jun 23 22:10:00 GMT 1999


Folks:


Thanks a million for egcs!


I want to use a constant expression as a template argument of 
pointer type.  Here is a sample program which compiles with 
g++ 2.8.1, but doesn't with egcs-2.91.66.  Appended is the 
output of running egcs.


Regards,

Zooko

------- begin included file `test.c'
template <int* foo> class Quux { };

typedef Quux<static_cast<int*>(0)> intQuux;

------- end included file `test.c'

------- begin included shell transcript
> g++ -c test.c
test.c:3: `0' is not a valid template argument
test.c:3: it must be a pointer to an object with external linkage
test.c:3: warning: ANSI C++ forbids typedef which does not specify a type
> 
------- end included shell transcript



More information about the Gcc-bugs mailing list