[clang] [Clang][AST/Sema] Fix lambda function pointer conversion operator immediate escalation (PR #235356)

Ferdinand Bachmann via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 24 14:38:36 PDT 2026


Ferdi265 wrote:

There are also several related cases that compile with GCC, but don't with Clang, and that this PR does not fix:

```c++
// conversion_call.cpp
int main() {
    auto a = []consteval{return 3;};
    auto b = ((int(*)())a)();
}
```

and

```c++
// function_call.cpp
consteval int g() {return 3;}

int main() {
    auto b = ((int(*)())g)();
}
```

and

```c++
// function_generic_call.cpp
consteval int g(auto) {return 3;}

int main() {
    auto b = ((int(*)(int))g)(0);
}
```

The latter example has nothing to do with lambdas, but feels very similar to the broken example (`conversion_generic_call.cpp`) from the above comment.

https://github.com/llvm/llvm-project/pull/235356


More information about the cfe-commits mailing list