Compiler Error C3417

 

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

member' : value types cannot contain user-defined special member functions

Value types cannot contain functions such as a default instance constructor, destructor, or copy constructor.

The following sample generates C3517:

// C3417.cpp  
// compile with: /clr /c  
value class VC {  
   VC(){}   // C3417  
  
   // OK  
   static VC(){}  
   VC(int i){}  
};  

Show: