This topic has not yet been rated - Rate this topic

Compiler Error C2918

'name' : illegal use of local type in template instantiation

You cannot generate a template function (a function from a function template) based on a local type. Types used to instantiate templates must have external linkage.

Example

// C2918.cpp
template<class T> void f(T t) {};

void g()
{
    struct X {};
    X x;

    f(x);          // C2918
}
int main()
{
}
Did you find this helpful?
(1500 characters remaining)