Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 1.57 KB

c26443.md

File metadata and controls

47 lines (34 loc) · 1.57 KB
title ms.date f1_keywords helpviewer_keywords description
Warning C26443
01/18/2017
C26443
NO_EXPLICIT_DTOR_OVERRIDE
C26443
Warning C26443 Rule concerning overriding destructors

Warning C26443

Overriding destructor should not use explicit 'override' or 'virtual' specifiers.

This warning was removed in Visual Studio 16.8 to reflect changes to C.128 in the C++ Core Guidelines.

C++ Core Guidelines

C.128: Virtual functions should specify exactly one of virtual, override, or final.

The current consensus on the Core Guidelines is to exclude destructors from the 'override explicitly' recommendation.

Notes

  • The rule flags overriding destructors that explicitly use 'virtual' or 'override' specifiers.
  • Destructors can still use the 'final' specifier because of its special semantics.
  • Warnings show up on function definitions, not declarations. It may be confusing, since definitions don't have virtual specifiers, but the warning is still appropriate.

Code analysis name: NO_EXPLICIT_DTOR_OVERRIDE

Example: Explicit 'override'

class Transaction {
public:
    virtual ~Transaction();
    // ...
};

class DistributedTransaction : public Transaction {
public:
    ~DistributedTransaction() override { // C26443
        // ...
    }
};

See also

C.128: Virtual functions should specify exactly one of virtual, override, or final