================
@@ -6464,6 +6464,9 @@ static ExprResult BuildConvertedConstantExpression(Sema 
&S, Expr *From,
   if (checkPlaceholderForOverload(S, From))
     return ExprError();
 
+  if (From->containsErrors())
+    return S.CreateRecoveryExpr(From->getBeginLoc(), From->getEndLoc(), 
{From}, T);
----------------
mizvekov wrote:

The RecoveryExpr marks a sub-expression as being semantically invalid, ie we 
shouldn't dig down past a RecoveryExpr in any Sema analysis. It would be just 
used for printing and source locations.

But that's not the same as bailing on an expression that merely contains 
errors, because that will make us ignore more AST nodes than intended.

So in that sense, this patch already compromises error recovery, but maybe 
that's not too bad as an emergency quick fix to stop a crash.

But back to the issue at hand, if we add a RecoveryExpr instead of an implicit 
cast, we are telling Sema to ignore the potentially valid underlying AST nodes.

What's the reasoning behind or evidence to want to do that?

https://github.com/llvm/llvm-project/pull/184210
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to