Skip to content

Ignore deleted constructors when considering whether a base class is initialized. #757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2024
Merged
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
2 changes: 2 additions & 0 deletions change_notes/2024-10-18-init-base-class-deleted.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `A12-1-1`, `RULE-15-1-2` - `InitializeAllVirtualBaseClasses.ql`, `ExplicitConstructorBaseClassInitialization.ql`:
- Remove false positives for deleted member functions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ query predicate problems(
not c.isCompilerGenerated() and
// Not a defaulted constructor
not c.isDefaulted() and
// Not a deleted constructor
not c.isDeleted() and
declaringType_string = declaringType.getSimpleName() and
baseClass_string = baseClass.getSimpleName() and
message =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,13 @@ class Derived6 : public Base2 {

private:
Base2 b;
};

class Base3 {};

class Derived7 final : public Base3 {
public:
Derived7() = delete; // COMPLIANT
Derived7(const Derived7 &) = delete; // COMPLIANT
Derived7(Derived7 &&) = delete; // COMPLIANT
};
Loading