www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17688] New: ICE with static foreach directly inside switch


          Issue ID: 17688
           Summary: ICE with static foreach directly inside switch
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ice, ice-on-valid-code
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: timon.gehr gmx.ch

The following code generates an ICE:

void main(){
    final switch(1) static foreach(x;0..1){ case 1: return; }

static foreach (x; 0 .. 1)
case 1:
return ;

core.exception.AssertError ddmd/blockexit.d(90): Assertion failure

The reason is that the DMD code base does not uphold some invariants I took for

Jul 25