================
@@ -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()));
----------------
term-est wrote:
Yeah, that fixes the linked issue, but it also Introduces regressions in the
test-suite
cxx2b-consteval-propagate.cpp
```c++
static_assert(none_of(
types,
+[](info i) consteval {
return is_invalid(i);
}
));
```
Clang diagnoses taking the address of the consteval call operator outside an
immediate invocation.
https://github.com/llvm/llvm-project/pull/214002
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits