Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- `RULE-13-3-1` - `MemberSpecifiersNotUsedAppropriately.ql`:
- Fixed false positives on implicitly declared member functions, most
commonly the implicit destructor of a class deriving from a class with a
virtual destructor. The rule applies to user-declared member functions
only, and an implicit destructor cannot carry `override` or `final`.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import codingstandards.cpp.misra
from MemberFunction f, string message
where
not isExcluded(f, Classes2Package::memberSpecifiersNotUsedAppropriatelyQuery()) and
// Only user-declared member functions are in scope, not implicitly declared
// ones such as an implicit destructor.
not f.isCompilerGenerated() and
(
// Case 1: Specifiers incompatible with explicitly virtual
f.isDeclaredVirtual() and
Expand Down
11 changes: 10 additions & 1 deletion cpp/misra/test/rules/RULE-13-3-1/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,13 @@ class C15 : public NonvirtualDestructorBase {
public:
virtual ~C15() =
default; // COMPLIANT: Note that this does not violate rule 6.4.2
};
};

class C16 : public VirtualDestructorBase {
// COMPLIANT: the destructor is implicitly declared, not user-declared
};

class C17 : public VirtualDestructorBase {
public:
C17() = default; // COMPLIANT: implicit virtual destructor not user-declared
};