Compiler Error C3226
Visual Studio 2015
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at Compiler Error C3226.
A template declaration is not allowed inside a generic declaration
Use a generic declaration inside a generic class.
The following sample generates C3226:
// C3226.cpp
// compile with: /clr
generic <class T>
ref class C {
template <class T1> // C3226
ref struct S1 {};
};
The following sample demonstrates a possible resolution:
// C3226b.cpp
// compile with: /clr /c
generic <class T>
ref class C {
generic <class T1>
ref struct S1 {};
};
Show: