digitalmars.D.bugs - [Issue 23586] New: DMD forgets a variable was just declared.
- d-bugmail puremagic.com (33/33) Dec 27 2022 https://issues.dlang.org/show_bug.cgi?id=23586
https://issues.dlang.org/show_bug.cgi?id=23586 Issue ID: 23586 Summary: DMD forgets a variable was just declared. Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: deadalnix gmail.com Sample code: int foo(int x) { switch(x) { case 0: goto Bar; Bar: default: auto y = 6; return y; } } void main() { auto x = foo(0); } What I get: Error: undefined identifier `y` What I expect: The compiler to remember the variable was declared the line immediately above and use that. --
Dec 27 2022