[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:53:26 PDT 2026


Ferdi265 wrote:

There is also another thing that is **fixed** by this PR but that I did not intend to fix.

Previously, Clang accepted code that stores a pointer to a function converted from a consteval generic lambda in a non-constexpr variable (GCC rejects this):

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

Since the conversion operator is now an immediate function, the call to it is now diagnosed at the conversion site. I don't understand why this did not trigger `cannot take address of consteval call operator` in Clang trunk though...

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


More information about the cfe-commits mailing list