Edit

Share via


Compiler Error C3412

'template' : cannot specialize template in current scope

A template cannot be specialized at class scope, only in global or namespace scope.

Examples

The following sample generates C3412.

// C3412.cpp
template <class T>
struct S {
   template <>
   struct S<int> {};   // C3412 in a class
};

The following sample shows a possible resolution.

// C3412b.cpp
// compile with: /c
template <class T>
struct S {};

template <>
struct S<int> {};