[Issue 22995] New: goto case cannot forward to outer case label
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Apr 7 12:47:47 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22995
Issue ID: 22995
Summary: goto case cannot forward to outer case label
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: minor
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: moonlightsentinel at disroot.org
Forward-references to a case inside the same switch works:
void foo(int i, int j)
{
final switch (i)
{
case 1:
break;
case 2:
final switch (j)
{
case 4:
goto case 3;
case 3:
break;
}
break;
}
}
But fails if the forward-referenced case belongs to an enclosing switch
statement:
void foo(int i, int j)
{
final switch (i)
{
case 1:
break;
case 2:
final switch (j)
{
case 4:
// goto case 1; // ok
goto case 3; // fails
}
break;
case 3:
break;
}
}
--
More information about the Digitalmars-d-bugs
mailing list