[Issue 24534] Having a label on a declaration makes it possible to skip it with goto

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun May 19 08:22:37 UTC 2024


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

--- Comment #8 from Richard (Rikki) Andrew Cattermole <alphaglosined at gmail.com> ---
I've done some playing around to see if backward goto's have an equivalent
issue.

It seems dmd is actually smart there, and I couldn't get that to not work.

Generates a try/finally:

```
Label:
    SomethingWithSideEffects var = 0;
    try
    {
        if (uniform01() > 0.5)
            return 0;
        goto Label;
    }
    finally
        var.~this();
```

This means only forward goto's have broken analysis.

--


More information about the Digitalmars-d-bugs mailing list