Ferdi265 wrote:

```c++
constexpr auto l = [] consteval {};
static_assert(
        +l
);
```

- the lambda declaration for `l` is consteval
- the unary + creates a `SynthesizedFunctionScope` for the synthesized operator
- the pushed expression evaluation context is `InImmediateFunctionContext` by 
default due to constant evaluation
- but this operator is not explicitly declared consteval, so 
`FD->isConsteval()` is false
- this causes `PushExpressionEvaluationContextForFunction` to set 
`InImmediateFunctionContext` to false
- this causes the wrong diagnostic

It looks like the lambda call operator must not inherit 
`InImmediateFunctionContext` from a parent context to avoid #183415, but other 
synthesized operators, such as the unary +, do need to inherit 
`InImmediateFunctionContext`. This will likely take a while to figure out 
properly.

https://github.com/llvm/llvm-project/pull/232458
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to