www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22191] New: -betterC: Overeager try/catch prohibition

https://issues.dlang.org/show_bug.cgi?id=22191

          Issue ID: 22191
           Summary: -betterC: Overeager try/catch prohibition
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: kinke gmx.net

```
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').

--
Aug 07 2021