Template instantiation & inheritance - fixed, but can I scrap the warning I get to do it?
John Graham
johngavingraham@googlemail.com
Sat Mar 6 12:00:00 GMT 2010
> I believe that since you are forcing explicit instantiation,
> you will probably have to instantiate ALL used templates, even if they
> are templates used by an instantiated template. Maybe someone in the
> know could confirm?
Fair enough - no mean feat since the compiler nicely tells you what
it's missing, I guess. It's just a puzzle to me that I didn't seem to
have to do any extra "instantiating" in my library but I do in a test
case - I'm obviously missing something subtle in the library.
> Perhaps you aren't using the same flag in the compilation of your
> program, and the code can see the template directly? Then you would
> have the explicitly instantiated subclass, and because you aren't
> telling the compiler to explicitly instantiate while compiling the
> executable, it takes care of implicitly instantiating anything used by
> the subclass? This is just a guess. Do you use that flag for
> compilation of all units?
In the example I sent earlier (as in the "real" case) I use
-fno-implicit-templates for the library, but *not* for the program.
And the program can definitely see all the template definitions as
they're included in header files, so I don't think that'll be the
case...
John G
More information about the Gcc-help
mailing list