cor3ntin wrote:

In C++26, exceptions are allowed in a constant evaluated context, which is used 
extensively by reflection and maybe P2300. I also think allowing `try` not to 
be a keyword in some modes would harm the ecosystem.

Here is an interesting scenario 

```cpp
constexpr void g() {
   throw 42;
} 

constexpr int f() {
   try {g(); } catch {}
   return 0;
}
```

static_assert(f() == 0); // the call to g() from here should be allowed

int main() {
  return f(); //  but not here if we want to disallow exceptions
}

```

So, now that I think about it, doing it at code gen is the only solution post 
C++26


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

Reply via email to