[Issue 23271] New: `goto` skips declaration of variable `bugred.A.test.__appendtmp4`

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 25 13:24:49 UTC 2022


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

          Issue ID: 23271
           Summary: `goto` skips declaration of variable
                    `bugred.A.test.__appendtmp4`
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: destructionator at gmail.com

dmd master broke this code:

---
class A {
        private static A[] active;
        private void test() {
                foreach(a; active)
                        if(a is this)
                                goto label;
                active ~= this;
                label:
                return;
        }
}
---

bugred.d(6): Error: `goto` skips declaration of variable
`bugred.A.test.__appendtmp4` at bugred.d(7)

--


More information about the Digitalmars-d-bugs mailing list