This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Template instantiation & inheritance - fixed, but can I scrap the warning I get to do it?
- From: John Graham <johngavingraham at googlemail dot com>
- To: Brian Budge <brian dot budge at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Sat, 6 Mar 2010 12:00:18 +0000
- Subject: Re: Template instantiation & inheritance - fixed, but can I scrap the warning I get to do it?
- References: <94cf76f1002270519m445ec76cyb231955b19e279ff@mail.gmail.com> <5b7094581002270824v669fa771y3d5f017c0aefa11c@mail.gmail.com> <94cf76f1002271037p69d7e23bia04d9cd6f913978d@mail.gmail.com> <5b7094581003010944v65eefe71tdd0249f9abd0635e@mail.gmail.com>
> 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