Ferdi265 wrote:
@efriedma-quic Just adding the lambda conversion operator to
`FunctionDecl::isImmediateEscalating()`
([commit](https://github.com/Ferdi265/llvm-project/commit/afcbed627652b335030654358baa00f6d4c66aaf)
/
[branch](https://github.com/Ferdi265/llvm-project/tree/fix-defect-lambda-conversion-immediate-escalation))
seems to fix your example, but breaks example `ns1_1` from
`clang/test/SemaCXX/cxx23-static-callop-lambda-expression.cpp`
```c++
auto lstatic = []() static consteval //expected-error{{cannot take address of
consteval call}} \
expected-note {{declared here}}
{ return 3; };
// FIXME: the above error should indicate that it was triggered below.
int (*f2)(void) = lstatic;
```
looking at the AST, it looks like the conversion function correctly picked up
the `immediate-escalating` tag on the `DeclRefExpr` to the call operator, but
the call operator itself was not marked `immediate`, causing the missed error
at the call site and making the code compile even though it shouldn't.
```
| |-CXXConversionDecl 0x55e4ab48c6b8 <line:1:16> col:16 implicit used constexpr
operator int (*)() 'int (*() const noexcept)()' inline internal-linkage
| | `-CompoundStmt 0x55e4ab4aa1b0 <col:16>
| | `-ReturnStmt 0x55e4ab4aa1a0 <col:16>
| | `-ImplicitCastExpr 0x55e4ab4aa188 <col:16> 'int (*)()'
<FunctionToPointerDecay>
| | `-DeclRefExpr 0x55e4ab4aa168 <col:16> 'int ()' lvalue CXXMethod
0x55e4ab48c210 'operator()' 'int ()' immediate-escalating
```
This sounds like another bug related to immediate-escalation of
functions/methods, I'll look into it.
https://github.com/llvm/llvm-project/pull/232458
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits