================
@@ -750,6 +750,19 @@ void InitListChecker::FillInEmptyInitForField(unsigned 
Init, FieldDecl *Field,
     if (Field->hasInClassInitializer()) {
       if (VerifyOnly)
         return;
+
+      // We do not want to aggressively set the hadError flag and cutoff
+      // parsing. Try to recover when in-class-initializer had errors.
+      if (Field->getInClassInitializer() &&
----------------
yronglin wrote:

I've move the code into BuildCXXDefaultInitExpr(), the original purpose of 
putting it here is to return quickly and avoid entering any context again.
```c++
    ExprResult DIE;
      {
        // Enter a default initializer rebuild context, then we can support
        // lifetime extension of temporary created by aggregate initialization
        // using a default member initializer.
        // CWG1815 (https://wg21.link/CWG1815).
        EnterExpressionEvaluationContext RebuildDefaultInit(
            SemaRef, Sema::ExpressionEvaluationContext::PotentiallyEvaluated);
        SemaRef.currentEvaluationContext().RebuildDefaultArgOrDefaultInit =
            true;
        SemaRef.currentEvaluationContext().DelayedDefaultInitializationContext =
            SemaRef.parentEvaluationContext()
                .DelayedDefaultInitializationContext;
        SemaRef.currentEvaluationContext().InLifetimeExtendingContext =
            SemaRef.parentEvaluationContext().InLifetimeExtendingContext;
        DIE = SemaRef.BuildCXXDefaultInitExpr(Loc, Field);
      }
```

https://github.com/llvm/llvm-project/pull/113049
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to