Compiler Error C3665
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Error C3665

'destructor' : override specifier 'keyword' not allowed on a destructor/finalizer

A keyword was used that is not allowed on a destructor or finalizer.

For example, a new slot cannot be requested on a destructor or finalizer. For more information, see Explicit Overrides and Destructors and Finalizers in Visual C++.

The following sample generates C3665:

// C3665.cpp
// compile with: /clr
public ref struct R {
   virtual ~R() { }
   virtual void a() { }

public ref struct S : R {
   virtual ~S() new {}   // C3665
   virtual void a() new {}   // OK
© 2015 Microsoft