================
@@ -1016,6 +1016,28 @@ class TrivialFunctionAnalysisVisitor
               (CtorDecl->isMoveConstructor() &&
                RD->hasTrivialMoveConstructor()))
             return true;
+          // A defaulted default constructor that nothing has used yet has no
+          // definition, so decide from the initializers it would run.
+          if (CtorDecl->isDefaultConstructor() && !CtorDecl->isDeleted() &&
+              !CtorDecl->doesThisDeclarationHaveABody() &&
+              RD->hasDefinition()) {
+            for (const FieldDecl *F : RD->fields()) {
+              if (const Expr *Init = F->getInClassInitializer()) {
+                if (!Visit(Init))
+                  return false;
+              } else if (!CanTriviallyConstruct(F->getType()))
----------------
steakhal wrote:

Why is this an `else if` ? I figured that I might have:
```c++
struct myclass {
  DeletesNThings field = /*N=*/3; // <-- N=3 class initializer, but the member 
type does delete...
}
```

https://github.com/llvm/llvm-project/pull/241102
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to