Compiler Error C2918

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

There was an attempt to generate a template function (that is, a function generated from a function template) based on a local type. A template can be instantiated only using a type with external linkage.

The following code will generate this error:

template<class T> void f(T t) {};

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

    f(x);          // error
}