```
void foo() nothrow {}
void main()
{
try { foo(); }
catch (Exception) {}
}
```
The frontend removes the try/catch from the AST at some point, so this should compile with -betterC too but doesn't ('Error: Cannot use try-catch statements with -betterC').
Comment #1 by Ajieskola — 2021-08-16T18:59:08Z
I'd argue it's good that this one does not compile. Not because it couldn't be compiled, but because checking for redundant `catch`ing isn't required behaviour in the spec. Programs that do this as -betterC would be relying on implementation-specific functionality.
Comment #2 by razvan.nitu1305 — 2023-04-10T10:06:20Z
Yes, I agree with Ate on this one. Maybe this should be the job of a linting tool.
Comment #3 by robert.schadek — 2024-12-13T19:17:57Z