digitalmars.D.bugs - [Issue 20179] New: 'goto' skips over declaration triggered for
- d-bugmail puremagic.com (32/32) Aug 28 2019 https://issues.dlang.org/show_bug.cgi?id=20179
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: nobody puremagic.com Reporter: pro.mathias.lang gmail.com 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. --
Aug 28 2019