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