[PATCH] D103511: [clang-tidy] Special member functions check should allow sole dtors by default
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 2 05:06:36 PDT 2021
aaron.ballman added a comment.
I think the C++ Core Guideline wording is... confusing. The rule title is `C.21: If you define or =delete any copy, move, or destructor function, define or =delete them all`, which I take literally. Using `= default` defines the function, so:
struct S {
virtual ~S() = default; // This defines the dtor
};
Because this defines the dtor, all the rest need to be defined as well per the rule. The enforcement on the rule says: `Enforcement (Simple) A class should have a declaration (even a =delete one) for either all or none of the copy/move/destructor functions.` and so it seems like the rule is requiring us to diagnose this case by default (pun retroactively intended), and so the option should remain as it is. In the code example you posted from the rule, I imagine that to be a load-bearing `// ... ` that defines all the rest of the members.
Perhaps the C++ Core Guideline authors can be enticed to update the rule to be more clear?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103511/new/
https://reviews.llvm.org/D103511
More information about the cfe-commits
mailing list