typedef Foo<> Foo;
It gives:
prog.cpp:4: error: 'typedef class Foo<int> Foo' redeclared as different kind of symbol prog.cpp:2: error: previous declaration of 'template<class TYPE> class Foo'
The error pretty much indicates what the problem is. The compiler sees Foo as redeclared.
However, this should compile and work:
template<typename TYPE = int> class Foo {}; typedef Foo<> FooClone; int main() { Foo<int> one; Foo<> two; FooClone three; return 0; }
source share