www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17834] New: ICE on switch-local case variable

https://issues.dlang.org/show_bug.cgi?id=17834

          Issue ID: 17834
           Summary: ICE on switch-local case variable
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ice
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: timon.gehr gmx.ch

void main(){
    switch(2){
        int i=2;
        case i:{}
        default:
    }
}

DMD v2.076.0 gives:

tt.d(5): Deprecation: case variables have to be const or immutable
tt.d(3): Deprecation: 'switch' skips declaration of variable tt.main.i at
tt.d(4)
Internal error: ddmd/backend/symbol.c 1039

--
Sep 17