================
@@ -18273,13 +18273,17 @@ void Sema::PushExpressionEvaluationContextForFunction(
Current.InImmediateEscalatingFunctionContext =
getLangOpts().CPlusPlus20 && FD->isImmediateEscalating();
- if (isLambdaMethod(FD))
- Current.InImmediateFunctionContext =
- FD->isConsteval() ||
- (isLambdaMethod(FD) && (Parent.isConstantEvaluated() ||
- Parent.isImmediateFunctionContext()));
- else
- Current.InImmediateFunctionContext = FD->isConsteval();
+ const bool InheritParentImmediateContext =
+ isLambdaMethod(FD) && !isLambdaCallOperator(FD);
+
+ // A lambda call operator body is not a subexpression of the enclosing
+ // lambda-expression. Other lambda methods may be synthesized while
+ // processing the lambda and need to inherit the enclosing evaluation
+ // context.
+ Current.InImmediateFunctionContext =
+ FD->isConsteval() ||
+ (InheritParentImmediateContext &&
+ (Parent.isConstantEvaluated() ||
Parent.isImmediateFunctionContext()));
----------------
cor3ntin wrote:
I think the whole thing can be simplified to
```
Current.InImmediateFunctionContext = FD->isConsteval();
```
https://github.com/llvm/llvm-project/pull/214002
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits