|T O P I C R E V I E W
||Posted - Jun 14 2017 : 09:22:43 AM
There is an option in code inspection settings that suggests declaring overriden function with 'override' specifier. However it has the same behavior for ordinary virtual functions and for virtual destructors.
C++ core guidelines state the following:
C.128: Virtual functions should specify exactly one of virtual, override, or final
However, it has a special remark for destructors:
"If a base class destructor is declared virtual, one should avoid declaring derived class destructors virtual or override. Some code base and tools might insist on override for destructors, but that is not the recommendation of these guidelines."
It would be nice to have a separate option in Code Inspection Settings for virtual destructors instead of a single option for all.
|2 L A T E S T R E P L I E S (Newest First)
||Posted - Sep 26 2017 : 10:58:00 PM
case=103139 is implemented in build 2235
||Posted - Jun 14 2017 : 11:45:36 AM
We are planning on adding an option for this (case=103139).
There are some interesting discussions regarding override on destructors, and there doesn't seem to be consensus. See: https://github.com/isocpp/CppCoreGuidelines/issues/721 and https://github.com/isocpp/CppCoreGuidelines/issues/832.