Compiler Error C3394

 

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

syntax error in constraint clause: found 'identifier' expected a type

A constraint was ill formed. For more information, see Constraints on Generic Type Parameters (C++/CLI).

The following sample generates C3394:

// C3394.cpp  
// compile with: /clr /c  
ref class MyClass {};  
ref class R {  
   generic<typename T>  
   where T : static   // C3394  
   // try the following line instead  
   // where T : MyClass  
   void f() {}  
};  

Show: