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

          Issue ID: 20179
           Summary: 'goto' skips over declaration triggered for unused
                    variable
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

The following code:
```
string foo () { return null; }

void main ()
{
    if (auto str = foo())
    {
        assert(str.length);
    L1:
    }
    else
        goto L1;
}
```

Produces "oa.d(10): Error: goto skips declaration of variable oa.main.str at
oa.d(5)"
But the variable is not used after L1.

--

Reply via email to