Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5343 from JohanEngelen/fail15535
fix Issue 15535 - Disallow "goto default" in final switches.
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fail15535.d(17): Error: goto default not allowed in final switch statement | ||
--- | ||
*/ | ||
|
||
void test() | ||
{ | ||
int i; | ||
switch (i) | ||
{ | ||
case 0: | ||
final switch (i) | ||
{ | ||
case 1: | ||
goto default; | ||
} | ||
default: | ||
break; | ||
} | ||
} |