Edit

Share via


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 How to: Define and consume classes and structs (C++/CLI).

Example

The following sample generates C3077.

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

ref struct rs {
protected:
   !rs(){}   // OK
};