Hi @all,

Could anyone tell me, why g++ cannot link in this case:

-----

template <typename T>
void doFunc();

template <typename T>
class foo
{
        void notUsed();
};

template <typename T>
inline void foo<T>::notUsed()
{
        doFunc<T>();   // <---- Linker cannot find doFunc<bool>()
}

template class foo<bool>;

int main()
{ return 0; }

-----

All other compilers I tried had no problems with this piece of code.

The member function "notUsed()" is declared "inline". However, the
explicit template instantiation is implementing it.

The above construct helped me avoiding some terrible workarounds. What
can I do to still use this way of implementation?

I had a look at some compiler switches like "-
fno_implement_inlines"... but no, that doesn't work. Other switches?

Greetings,
Kirsten

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to