cor3ntin wrote:

> @cor3ntin One thing I'm trying to work out in tests is whether there is any 
> way to get a discarded block that should cause an error in the containing 
> scope but not if it occurred in the lamda instantiation.

There are never any errors ignored in discarded statements. If the `if 
constexpr` appears in a template its content is not instantiated. But it is 
always parsed.

If you want to write a tests where the `if constexpr(false)` is in a template, 
and calls a dependent/generic lambda that can never be instantiated... you can! 
Maybe something like that:

```cpp
template <typename T>
void f() {
  auto x = []<typename U>(U, U = U::bar) {};
  if constexpr(false) {
        x(T{});
  }
}
int _ = (f<int>(), 0);
```

https://github.com/llvm/llvm-project/pull/153921
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to