Compiler Error C3077

 

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

finalizer' : a finalizer can only be a member of a reference type

You cannot declare a finalizer in a native or value type.

For more information, see Destructors and Finalizers in Visual C++.

The following sample generates C3077.

// C3077.cpp  
// compile with: /clr /c  
value struct vs {  
   !vs(){}   // C3077  
};  
  
ref struct rs {  
protected:  
   !rs(){}   // OK  
};  

Show: