[clang] [Clang] Do not inherit immediate-function context in lambda bodies (PR #214002)

via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 5 19:50:28 PDT 2026


================
@@ -1601,6 +1601,11 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
   // cleanups from the enclosing full-expression.
   PushExpressionEvaluationContextForFunction(
       ExpressionEvaluationContext::PotentiallyEvaluated, LSI->CallOperator);
+
+  // A lambda body does not inherit the immediate-function context of the
+  // enclosing lambda-expression.
+  currentEvaluationContext().InImmediateFunctionContext =
+      LSI->CallOperator->isConsteval();
----------------
term-est wrote:

Thank you, I was hyperfocused on SemaLambda
I carried the fix to the `PushExpressionEvaluationContextForFunction`

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


More information about the cfe-commits mailing list