[clang] [Clang] Do not inherit immediate-function context in lambda bodies (PR #214002)
Corentin Jabot via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 5 02:50:02 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();
----------------
cor3ntin wrote:
`PushExpressionEvaluationContextForFunction` already does that.
Did you explore whether there might be a bug in PushExpressionEvaluationContextForFunction ?
https://github.com/llvm/llvm-project/pull/214002
More information about the cfe-commits
mailing list