Error with default enum template parameter

Andrey Slepuhin pooh@msu.ru
Mon Jan 26 09:44:00 GMT 1998


The following trivial example breaks egcs-980122:

-----------test1.cc----------------
typedef enum {
  x1,
  x2
} enum_type;

template <enum_type t=x1>
struct X{};


void main()
{
  X<> var;
}
-----------------------------------
test1.cc: In function `int main(...)':
test1.cc:12: non-constant `x1' cannot be used as template argument
test1.cc:12: warning: ANSI C++ forbids declaration `var' with no type
-----------------------------------

Note, that if I explicitly use template parameter (i.e. X<x1> var;)
all compiles Ok. Also all is Ok if I use integral type instead of enum.

Andrey.






More information about the Gcc mailing list