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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to