Compiler Error C2919

illegal use of anonymous 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; 

    f(x);         // error
}