[Issue 15535] New: Emit error on "goto default" in final switch
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Sat Jan  9 13:31:34 PST 2016
    
    
  
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 at puremagic.com
          Reporter: goejendaagh at 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.
--
    
    
More information about the Digitalmars-d-bugs
mailing list