[clang] fix explicit incomplete enum (PR #184210)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 2 14:57:07 PST 2026
================
@@ -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);
----------------
erichkeane wrote:
@mizvekov is at least a little right in that having a `RecoveryExpr` inside a `RecoveryExpr` is a little goofy. BUT IMO, we're better off trying to maintain AST fidelity here to let other cascading issues appear, over returning `ExprError`.
My thoughts are: We have two options for that; 1- Emit a RecoveryExpr that wraps a RecoveryExpr. We do that rarely.
2- Figure out how to 'continue' this function with the RecoveryExpr we already have. So rather than bailing out here, we 'teach' the PerformImplicitConversion logic to handle a RecoveryExpr in some way, by figuring out how we want this to 'cast' right. IMO, this is quite a bit more work, and seemed like a greater risk.
IF you were to look into 2 for Mattheus (to at least evaluate the difficulty here), it might make everyone more comfortable with this.
https://github.com/llvm/llvm-project/pull/184210
More information about the cfe-commits
mailing list