[clang] [Clang] _default-movable_ should be based on the first declaration (PR #143661)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 11 05:05:26 PDT 2025


================
@@ -2045,6 +2047,8 @@ static void DiagnoseNonDefaultMovable(Sema &SemaRef, SourceLocation Loc,
           << Decl->isMoveAssignmentOperator() << Decl->getSourceRange();
   }
   CXXDestructorDecl *Dtr = D->getDestructor();
+  if (Dtr)
----------------
AaronBallman wrote:

I think this is a bit clearer as:
```
if (const CXXDestructorDecl *Dtor = D->getDestructor()) {
  Dtor = Dtor->getCanonicalDecl();
  if (Dtr->isUserProvided() && !Dtr->isDefaulted()) {
    SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)
        << diag::TraitNotSatisfiedReason::DeletedDtr << /*User Provided*/ 1
        << Dtr->getSourceRange();
  }
}
```

https://github.com/llvm/llvm-project/pull/143661


More information about the cfe-commits mailing list