Skip to content

Commit 850299b

Browse files
committed
Fixed inherited ctrs.
1 parent f208801 commit 850299b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

clang/lib/Sema/SemaTypeTraits.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2607,6 +2607,29 @@ static void DiagnoseNonAggregateReason(Sema &SemaRef, SourceLocation Loc,
26072607
<< diag::TraitNotSatisfiedReason::InheritedCtr;
26082608
}
26092609

2610+
bool HasInherited = false;
2611+
for (const Decl *Sub : D->decls()) {
2612+
if (auto *UD = dyn_cast<UsingDecl>(Sub)) {
2613+
for (auto I = UD->shadow_begin(), E = UD->shadow_end(); I != E; ++I) {
2614+
if (isa<ConstructorUsingShadowDecl>(*I)) {
2615+
HasInherited = true;
2616+
break;
2617+
}
2618+
}
2619+
if (HasInherited)
2620+
break;
2621+
}
2622+
if (isa<ConstructorUsingShadowDecl>(Sub)) {
2623+
HasInherited = true;
2624+
break;
2625+
}
2626+
}
2627+
2628+
if (HasInherited) {
2629+
SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)
2630+
<< diag::TraitNotSatisfiedReason::InheritedCtr;
2631+
}
2632+
26102633
for (const FieldDecl *Field : D->fields()) {
26112634
switch (Field->getAccess()) {
26122635
case AS_private:

0 commit comments

Comments
 (0)