================ @@ -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; + } + + for (const FieldDecl *Field : D->fields()) { + switch (Field->getAccess()) { + case AS_private: + SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason) + << diag::TraitNotSatisfiedReason::PrivateDirectDataMember; + break; + case AS_protected: + SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason) + << diag::TraitNotSatisfiedReason::ProtectedDirectDataMember; + break; + default: + break; + } ---------------- cor3ntin wrote:
I think we could merge these two diagnostics 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