Export (0) Print
Expand All

Compiler Error C2926

'type' : local types or unnamed types cannot be used as type arguments

You cannot instantiate a generic or template class based on a local or unnamed type. Types used to instantiate must have external linkage.

The following sample generates C2926:

// C2926.cpp
// compile with: /Za
template<class T> 
class X {};
struct Z{};

int main() {
   struct Y{};
    X<Y> x;   // C2926
    X<Z> x2;   // OK
© 2014 Microsoft