[Issue 23586] New: DMD forgets a variable was just declared.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Dec 27 23:20:04 UTC 2022
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 at puremagic.com
Reporter: deadalnix at 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.
--
More information about the Digitalmars-d-bugs
mailing list