[clang] fix explicit incomplete enum (PR #184210)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 2 14:52:27 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);
----------------
Serosh-commits wrote:
my initial concern was that BuildConvertedConstantExpression is expected to return an expr of type T. While returning ExprError() is safe because callers check isInvalid() immediately, it leaves the specifier with a nullptr expr in the ast, i think Using a RecoveryExpr with type T keeps the AST typed right while still marking the error. that the safer option here isn't it ?
https://github.com/llvm/llvm-project/pull/184210
More information about the cfe-commits
mailing list