Compiler Error C3215

 

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 C3215.

type1' : generic type parameter already constrained by 'type2'

A constraint was specified more than once.

For more information on generics, see Generics.

The following sample generates C3215:

// C3215.cpp  
// compile with: /clr  
interface struct A {};  
  
generic <class T>  
where T : A,A  
ref class C {};   // C3215  

Possible resolution:

// C3215b.cpp  
// compile with: /clr /c  
interface struct A {};  
  
generic <class T>  
where T : A  
ref class C {};  

Show: