================
@@ -2595,6 +2597,97 @@ static void DiagnoseNonStandardLayoutReason(Sema 
&SemaRef, SourceLocation Loc,
   SemaRef.Diag(D->getLocation(), diag::note_defined_here) << D;
 }
 
+static void DiagnoseNonAggregateReason(Sema &SemaRef, SourceLocation Loc,
+                                       const CXXRecordDecl *D) {
+  for (const CXXConstructorDecl *Ctor : D->ctors()) {
+    if (Ctor->isUserProvided())
+      SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)
+          << diag::TraitNotSatisfiedReason::UserDeclaredCtr;
+    if (Ctor->isInheritingConstructor())
+      SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)
+          << diag::TraitNotSatisfiedReason::InheritedCtr;
+  }
+
+  bool HasInherited = llvm::any_of(D->decls(), [](auto const *Sub) {
+    bool Result = false;
+    if (auto *UD = dyn_cast<UsingDecl>(Sub)) {
+      Result = llvm::any_of(UD->shadows(), [](auto const &I) {
+        return isa<ConstructorUsingShadowDecl>(I);
+      });
+    }
+    return isa<ConstructorUsingShadowDecl>(Sub) || Result;
+  });
+
+  if (HasInherited) {
+    SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)
+        << diag::TraitNotSatisfiedReason::InheritedCtr;
+  }
----------------
cor3ntin wrote:

The loop above should be sufficient, right? Why do we  check for inherited 
constructors twice?

https://github.com/llvm/llvm-project/pull/152488
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to