[Bug c++/33878] Pure virtual method body omitted from template

herwig at gdsys dot de gcc-bugzilla@gcc.gnu.org
Tue Apr 1 14:38:00 GMT 2008



------- Comment #9 from herwig at gdsys dot de  2008-04-01 14:38 -------
(In reply to comment #8)
> Subject: Re:  Pure virtual method body omitted from template
> 
> 
> > thanks for the clarification. I should have realized it myself, though. I
> > solved the problem in another way, but out of pure curiosity: How can I
> > implicitly instatiate this function
> 
> That's a self-contradiction. The term "implicit instantiation" refers to 
> something that the compiler does without any explicit user request, so 
> there is no way to "implicitly instatiate this function yourself" :-)

Great, I already had the feeling my brain dead-locked when thinking about a
solution. :)

> You could explicitly instantiate this function, but...
> 
> > It needs to be a generic solution
> 
> The only possibility in this case would be to put the function into your 
> header file. I believe that that should work in your case.

Okay, you mean in the header file where I derive a class from TBase. There I'll
write something like:

class MyClass : public TBase<MyClass>
{
// My class goes here, espacially overiding pvMethod()...
};

void TBase<MyClass>::pvMethod()
{
// Not so generic dummy function
// Copy and paste error handling here ;)
}

Not exactly what I wanted...

Or did you mean that the function definition is in the TBase header file? If
so: It is.

Thanks for your kind help!

Regards,
Björn!


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33878



More information about the Gcc-bugs mailing list