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

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 15 22:08:29 PDT 2025


ojhunt wrote:

Out of curiosity I looked at this, and here we do end up doing the right thing, though I assume in the case of an inferred return we end up simply ignoring the interior branch of the `if(0)` entirely:

```cpp
auto f() {
  auto l = [](auto) { return true; };
  if constexpr (0)
    return l(1);
  return false;
}
```

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


More information about the cfe-commits mailing list