Skip to content

Commit ac30f8a

Browse files
committed
Try to recover when in-class-initializer had errors
Signed-off-by: yronglin <[email protected]>
1 parent cf5a038 commit ac30f8a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

clang/lib/Sema/SemaInit.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,8 +752,9 @@ void InitListChecker::FillInEmptyInitForField(unsigned Init, FieldDecl *Field,
752752
return;
753753

754754
// We do not want to aggressively set the hadError flag and cutoff
755-
// parsing. Try to recover when in-class-initializer is a RecoveryExpr.
756-
if (isa_and_nonnull<RecoveryExpr>(Field->getInClassInitializer())) {
755+
// parsing. Try to recover when in-class-initializer had errors.
756+
if (Field->getInClassInitializer() &&
757+
Field->getInClassInitializer()->containsErrors()) {
757758
if (Init < NumInits)
758759
ILE->setInit(Init, Field->getInClassInitializer());
759760
else

0 commit comments

Comments
 (0)