[clang] [Clang] Correctly handle allocations in the condition of a `if constexpr` (PR #146890)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 3 07:13:07 PDT 2025


================
@@ -1931,15 +1931,13 @@ Parser::ParseCXXCondition(StmtResult *InitStmt, SourceLocation Loc,
       return ParseCXXCondition(nullptr, Loc, CK, MissingOK);
     }
 
-    ExprResult Expr = [&] {
-      EnterExpressionEvaluationContext Eval(
-          Actions, Sema::ExpressionEvaluationContext::ConstantEvaluated,
-          /*LambdaContextDecl=*/nullptr,
-          /*ExprContext=*/Sema::ExpressionEvaluationContextRecord::EK_Other,
-          /*ShouldEnter=*/CK == Sema::ConditionKind::ConstexprIf);
-      // Parse the expression.
-      return ParseExpression(); // expression
-    }();
+    EnterExpressionEvaluationContext Eval(
----------------
erichkeane wrote:

Is the intent to have this eval context apply to the rest of the branch here?  the rest here?  I realize the lambda was a little silly, but it at least limited this to the expression itself?  

I could SWEAR we just touched this less than a month ago...

https://github.com/llvm/llvm-project/pull/146890


More information about the cfe-commits mailing list