Reputation: 23
I'm getting a "template definition of non-template" compile error while trying to implement something like this :
class BaseFoo
{
BaseFoo();
~BaseFoo();
virtual void method();
};
template <class A>
class Foo : public BaseFoo
{
Foo();
~Foo();
virtual void method();
};
Is it possible to redefine a method in a template class if it was previously defined in its baseclass which is not a templated class ?
Upvotes: 2
Views: 1053
Reputation: 33116
Apparently this is a bug that was finally fixed in gcc 4.2. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27211 .
Upvotes: 3
Reputation: 24140
Yes, this sort of thing is perfectly legal. The code you provided compiles fine in gcc 4.2.1.
Is this the exact code you are getting the error for? What compiler are you using?
Upvotes: 0