[clang] [clang] return type not correctly deduced for discarded lambdas (PR #153921)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Sat Aug 16 14:26:27 PDT 2025


ojhunt wrote:

> ```c++
>   auto x = []<typename U>(U, U = U::bar) {};
> ```

I think I technically knew you could have templated lambdas, but I certainly forgot about it entirely :D

What I'm trying to construct is something that would not trigger an error if it was wrapped in an `if constexpr(0)` inside the lambda body, but that should trigger an error in the outer portions of the lambda. The goal being to test that we do the context change in the right place. The problem of course is that I can't tell if we're doing the right thing, or I'm writing the tests wrong :D

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


More information about the cfe-commits mailing list