[EMAIL PROTECTED] writes: > Could anyone tell me, why g++ cannot link in this case:
Because it is invalid? > All other compilers I tried had no problems with this piece of code. They did? The only compiler I can link your code with is Sun CC (11 and 12) and IBM xlC. All other compilers (VC6, 8, HP aCC), Intel icc -- fail with unresolved `void doFunc<bool>()'. > The member function "notUsed()" is declared "inline". However, the > explicit template instantiation is implementing it. It isn't implementing anything. It is asking the compiler to provide instantiations of all foo<bool>::* methods, which compilers other than xlC and SunCC oblige to do, introducing the unresolved symbol. > The above construct helped me avoiding some terrible workarounds. What > can I do to still use this way of implementation? You didn't tell what problem this helped you avoid, but if you want to instantiate foo<bool>::notUsed(), then you must provide doFunc<bool>() (in this, or some other compilation unit). > I had a look at some compiler switches like > "-fno_implement_inlines"... but no, that doesn't work. Of course it doesn't work. How do you expect the compiler to come up with body for doFunc<bool>() if you didn't supply one? BTW, the only reason SunCC and xlC are able to link this is because they ignore your explicit instantiation request (i.e. it's a bug in the compiler -- they should have failed as well). Cheers, -- In order to understand recursion you must first understand recursion. Remove /-nsp/ for email. _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus