Bug 17688 – ICE with static foreach directly inside switch
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-07-25T23:59:11Z
Last change time
2017-08-16T13:24:11Z
Keywords
ice, ice-on-valid-code
Assigned to
No Owner
Creator
timon.gehr
Comments
Comment #0 by timon.gehr — 2017-07-25T23:59:11Z
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.