Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 1.09 KB

compiler-warning-level-1-c4461.md

File metadata and controls

39 lines (30 loc) · 1.09 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (level 1) C4461
Compiler Warning (level 1) C4461
11/04/2016
C4461
C4461
104ffecc-3dd4-4cb1-89a8-81154fbe46d9

Compiler Warning (level 1) C4461

'type' : this class has a finalizer 'finalizer' but no destructor 'dtor'

The presence of a finalizer in a type implies resources to delete. Unless a finalizer is explicitly called from the type's destructor, the common language runtime determines when to run the finalizer, after your object goes out of scope.

If you define a destructor in the type and explicitly call the finalizer from the destructor, you can deterministically run your finalizer.

For more information, see Destructors and finalizers.

Example

The following sample generates C4461.

// C4461.cpp
// compile with: /W1 /clr /c
ref class A {
protected:
   !A() {}   // C4461
};

// OK
ref struct B {
   ~B() {
      B::!B();
   }

   !B() {}
};