help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Explicite Template Instantiation and Inline


From: tthunder
Subject: Explicite Template Instantiation and Inline
Date: 18 May 2007 16:09:15 -0700
User-agent: G2/1.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]