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@ddmd/blockexit.d(90): Assertion failure ---------------- --- The reason is that the DMD code base does not uphold some invariants I took for granted.
https://github.com/dlang/dmd/pull/7023
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/7ebda47f6a162ce3de774a042207eb883908b650 fix Issue 17688 - ICE with static foreach directly inside switch https://github.com/dlang/dmd/commit/e1e68148e0cd0eb1cfa21a8c0b24afcf7f3781f9 Merge pull request #7023 from tgehr/fix17688 fix Issue 17688 - ICE with static foreach directly inside switch merged-on-behalf-of: Walter Bright <WalterBright@users.noreply.github.com>
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/7ebda47f6a162ce3de774a042207eb883908b650 fix Issue 17688 - ICE with static foreach directly inside switch https://github.com/dlang/dmd/commit/e1e68148e0cd0eb1cfa21a8c0b24afcf7f3781f9 Merge pull request #7023 from tgehr/fix17688