Thread overview
[Issue 24802] misleading "cannot `goto` into `try` block" when skipping variable with destructor
[Issue 24802] Wrong error message
Oct 09
Dennis
Oct 09
Dennis
Oct 11
Manu
October 09
https://issues.dlang.org/show_bug.cgi?id=24802

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel@live.nl
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=24300

--- Comment #1 from Dennis <dkorpel@live.nl> ---
The compiler rewrites things that happen on scope exit (such as destructors)
into try-finally blocks. The same happens with scope guards:
```
void main()
{
    goto x;
    scope(exit) {}
    x:
}
```

See also issue 24300. The solution is probably to add a field to the lowered AST node keeping track of where a try-finally block came from.

--
October 09
https://issues.dlang.org/show_bug.cgi?id=24802

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
           Priority|P1                          |P3
            Summary|Wrong error message         |misleading "cannot `goto`
                   |                            |into `try` block" when
                   |                            |skipping variable with
                   |                            |destructor

--
October 11
https://issues.dlang.org/show_bug.cgi?id=24802

--- Comment #2 from Manu <turkeyman@gmail.com> ---
Is that efficient? Does that affect optimisation opportunities in any way?

--