[Issue 17688] New: ICE with static foreach directly inside switch

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jul 25 16:59:11 PDT 2017


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

          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 at puremagic.com
          Reporter: timon.gehr at gmx.ch

The following code generates an ICE:

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

---
Statement::blockExit(0x7fe21d91c360)
static foreach (x; 0 .. 1)
{
case 1:
{
return ;
}
}

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

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

--


More information about the Digitalmars-d-bugs mailing list