Skip to content

Commit c107f67

Browse files
committed
Swapped bases and fields diagnostics.
1 parent f1b6862 commit c107f67

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

clang/lib/Sema/SemaTypeTraits.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2660,33 +2660,33 @@ static void DiagnoseNonAggregateReason(Sema &SemaRef, SourceLocation Loc,
26602660
<< diag::TraitNotSatisfiedReason::InheritedCtr;
26612661
}
26622662

2663-
for (const FieldDecl *Field : D->fields()) {
2664-
auto AccessSpecifier = Field->getAccess();
2663+
for (const CXXBaseSpecifier &B : D->bases()) {
2664+
if (B.isVirtual()) {
2665+
SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)
2666+
<< diag::TraitNotSatisfiedReason::VBase << B.getType()
2667+
<< B.getSourceRange();
2668+
continue;
2669+
}
2670+
auto AccessSpecifier = B.getAccessSpecifier();
26652671
switch (AccessSpecifier) {
26662672
case AS_private:
26672673
case AS_protected:
26682674
SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)
2669-
<< diag::TraitNotSatisfiedReason::PrivateProtectedDirectDataMember
2675+
<< diag::TraitNotSatisfiedReason::PrivateProtectedDirectBase
26702676
<< (AccessSpecifier == AS_protected);
26712677
break;
26722678
default:
26732679
break;
26742680
}
26752681
}
26762682

2677-
for (const CXXBaseSpecifier &B : D->bases()) {
2678-
if (B.isVirtual()) {
2679-
SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)
2680-
<< diag::TraitNotSatisfiedReason::VBase << B.getType()
2681-
<< B.getSourceRange();
2682-
continue;
2683-
}
2684-
auto AccessSpecifier = B.getAccessSpecifier();
2683+
for (const FieldDecl *Field : D->fields()) {
2684+
auto AccessSpecifier = Field->getAccess();
26852685
switch (AccessSpecifier) {
26862686
case AS_private:
26872687
case AS_protected:
26882688
SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)
2689-
<< diag::TraitNotSatisfiedReason::PrivateProtectedDirectBase
2689+
<< diag::TraitNotSatisfiedReason::PrivateProtectedDirectDataMember
26902690
<< (AccessSpecifier == AS_protected);
26912691
break;
26922692
default:

0 commit comments

Comments
 (0)