title | ms.date | f1_keywords | helpviewer_keywords | description | |||
---|---|---|---|---|---|---|---|
Warning C26443 |
01/18/2017 |
|
|
Warning C26443 Rule concerning overriding destructors |
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.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.
- 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
class Transaction {
public:
virtual ~Transaction();
// ...
};
class DistributedTransaction : public Transaction {
public:
~DistributedTransaction() override { // C26443
// ...
}
};
C.128: Virtual functions should specify exactly one of virtual, override, or final