================
@@ -5563,6 +5563,12 @@ ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation 
CallLoc,
 ExprResult Sema::BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field) 
{
   assert(Field->hasInClassInitializer());
 
+  // We do not want to aggressively cutoff parsing. Try to recover when
+  // in-class-initializer had errors.
+  if (Field->getInClassInitializer() &&
+      Field->getInClassInitializer()->containsErrors())
+    return Field->getInClassInitializer();
----------------
efriedma-quic wrote:

I guess the idea here is that we're throwing away too much if we just return an 
ExprError?  I assume everything would work without crashing, we'd just produce 
slightly different diagnostics.  So... I guess my first question is, do we 
really need to do this in this patch, as opposed to a followup?

BuildCXXDefaultInitExpr is supposed to, as the name suggests, return a 
CXXDefaultInitExpr.  As-is, this is going to produce weird results with 
erroneous expressions that aren't just a RecoveryExpr, like typo corrections.  
Maybe we can explicitly create a RecoveryExpr here, though, nested inside the 
CXXDefaultInitExpr, or something like that.

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