[Issue 18858] New: switch 'skips declaration' test only checks last declaration
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon May 14 20:06:32 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18858
Issue ID: 18858
Summary: switch 'skips declaration' test only checks last
declaration
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: bugzilla at digitalmars.com
Consider:
int test(int n)
{
final switch(n)
{
enum e = 6;
int z = 5; // Error: switch skips declaration of variable test.z
case 1:
int y = 2;
return y;
}
}
Good. Now reverse the enum e and int z statements, and no error will be
generated.
--
More information about the Digitalmars-d-bugs
mailing list