[clang] [Clang] Functions called in discarded statements should not be instantiated (PR #140576)

Daniel Bertalan via cfe-commits cfe-commits at lists.llvm.org
Tue May 20 16:39:16 PDT 2025


BertalanD wrote:

@cor3ntin fyi, we have been seeing build failures since this commit on code like this:

```c++
void should_compile() {
  if constexpr (false) {
    auto lam = []() { return 0; };
    1 | lam();
  }
}
```
The error is:
```console
bug.cpp:4:7: error: invalid operands to binary expression ('int' and 'void')
    4 |     1 | lam();
      |     ~ ^ ~~~~~
1 error generated.
```

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


More information about the cfe-commits mailing list