Skip to content

Commit 5a49d52

Browse files
committed
merged
1 parent dc7c3c2 commit 5a49d52

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

clang/lib/Sema/SemaTypeTraits.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,6 +1965,7 @@ static std::optional<TypeTrait> StdNameToTypeTrait(StringRef Name) {
19651965
.Case("is_assignable", TypeTrait::BTT_IsAssignable)
19661966
.Case("is_empty", TypeTrait::UTT_IsEmpty)
19671967
.Case("is_standard_layout", TypeTrait::UTT_IsStandardLayout)
1968+
.Case("is_aggregate", TypeTrait::UTT_IsAggregate)
19681969
.Case("is_constructible", TypeTrait::TT_IsConstructible)
19691970
.Default(std::nullopt);
19701971
}
@@ -2595,6 +2596,11 @@ static void DiagnoseNonStandardLayoutReason(Sema &SemaRef, SourceLocation Loc,
25952596
SemaRef.Diag(D->getLocation(), diag::note_defined_here) << D;
25962597
}
25972598

2599+
static void DiagnoseNonAggregateReason(Sema &SemaRef, SourceLocation Loc, QualType T) {
2600+
SemaRef.Diag(Loc, diag::note_unsatisfied_trait)
2601+
<< T << diag::TraitName::Aggregate;
2602+
}
2603+
25982604
void Sema::DiagnoseTypeTraitDetails(const Expr *E) {
25992605
E = E->IgnoreParenImpCasts();
26002606
if (E->containsErrors())
@@ -2627,6 +2633,9 @@ void Sema::DiagnoseTypeTraitDetails(const Expr *E) {
26272633
case TT_IsConstructible:
26282634
DiagnoseNonConstructibleReason(*this, E->getBeginLoc(), Args);
26292635
break;
2636+
case UTT_IsAggregate:
2637+
DiagnoseNonAggregateReason(*this, E->getBeginLoc(), Args[0]);
2638+
break;
26302639
default:
26312640
break;
26322641
}

0 commit comments

Comments
 (0)