www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24300] New: error message for a jump over `scope(exit)` leaks

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

          Issue ID: 24300
           Summary: error message for a jump over `scope(exit)` leaks
                    internal details
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

The error output for

```d
extern(C) int puts(const char*);

int main () {
  goto L0;
  scope(exit) puts("meow");

  L0:
  puts("cat says");

  return 0;
}  
```

is 

 Error: cannot `goto` into `try` block
This leaks the fact that the exit scope guard is lowered to a try-finally statement, a detail that does not necessarily interests the user or that can even be confusing A better message would be
 Error: cannot `goto` skip over `exit` scope guard
--
Dec 25 2023