@@ -2660,6 +2660,11 @@ static void DiagnoseNonAggregateReason(Sema &SemaRef, SourceLocation Loc,
26602660 << diag::TraitNotSatisfiedReason::InheritedCtr;
26612661 }
26622662
2663+ if (D->isPolymorphic ())
2664+ SemaRef.Diag (Loc, diag::note_unsatisfied_trait_reason)
2665+ << diag::TraitNotSatisfiedReason::PolymorphicType
2666+ << D->getSourceRange ();
2667+
26632668 for (const CXXBaseSpecifier &B : D->bases ()) {
26642669 if (B.isVirtual ()) {
26652670 SemaRef.Diag (Loc, diag::note_unsatisfied_trait_reason)
@@ -2680,6 +2685,14 @@ static void DiagnoseNonAggregateReason(Sema &SemaRef, SourceLocation Loc,
26802685 }
26812686 }
26822687
2688+ for (const CXXMethodDecl *Method : D->methods ()) {
2689+ if (Method->isVirtual ()) {
2690+ SemaRef.Diag (Loc, diag::note_unsatisfied_trait_reason)
2691+ << diag::TraitNotSatisfiedReason::VirtualFunction << Method
2692+ << Method->getSourceRange ();
2693+ }
2694+ }
2695+
26832696 for (const FieldDecl *Field : D->fields ()) {
26842697 auto AccessSpecifier = Field->getAccess ();
26852698 switch (AccessSpecifier) {
@@ -2694,19 +2707,6 @@ static void DiagnoseNonAggregateReason(Sema &SemaRef, SourceLocation Loc,
26942707 }
26952708 }
26962709
2697- if (D->isPolymorphic ())
2698- SemaRef.Diag (Loc, diag::note_unsatisfied_trait_reason)
2699- << diag::TraitNotSatisfiedReason::PolymorphicType
2700- << D->getSourceRange ();
2701-
2702- for (const CXXMethodDecl *Method : D->methods ()) {
2703- if (Method->isVirtual ()) {
2704- SemaRef.Diag (Loc, diag::note_unsatisfied_trait_reason)
2705- << diag::TraitNotSatisfiedReason::VirtualFunction << Method
2706- << Method->getSourceRange ();
2707- }
2708- }
2709-
27102710 SemaRef.Diag (D->getLocation (), diag::note_defined_here) << D;
27112711}
27122712
0 commit comments