digitalmars.D.bugs - [Issue 15535] New: Emit error on "goto default" in final switch
- via Digitalmars-d-bugs (25/25) Jan 09 2016 https://issues.dlang.org/show_bug.cgi?id=15535
https://issues.dlang.org/show_bug.cgi?id=15535 Issue ID: 15535 Summary: Emit error on "goto default" in final switch Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: goejendaagh zonnet.nl This code compiles, but I think it shouldn't: void main() { int i; final switch(i) { case 1: goto default; } } When executed, the program immediately crashes. Because a final switch cannot have a "default:" case, I think the compiler error on this code. --
Jan 09 2016