Bug 6118 – nested overloaded foreach in contract crashes dmd

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-06-06T17:34:00Z
Last change time
2015-07-01T08:06:11Z
Keywords
contracts
Assigned to
nobody
Creator
viritrilbia+d

Comments

Comment #0 by viritrilbia+d — 2011-06-06T17:34:52Z
The following code crashes DMD v2.053 with "Internal error: ../ztc/cgcs.c 363": class foo { int opApply(int delegate(ref int) dg) const { return 0; } foo bar() out(result) { foreach (x ; result) foreach (y ; result) assert(x); } body { return this; } } I haven't been able to simplify the code any further and still reproduce the crash. Removing the second foreach makes it compile, as does replacing "assert(x)" with anything not referring to "x".
Comment #1 by lovelydear — 2012-04-24T01:06:02Z
Also crashes on 2.059 Win32.
Comment #2 by maximzms — 2013-03-04T09:24:04Z
Linux, 64-bit DMD Git head: https://github.com/D-Programming-Language/dmd/commit/13b3bdbf3819fec810ebfb077957510612dfa815 -------------------- Internal error: backend/cgcs.c 343 --------------------
Comment #3 by k.hara.pg — 2015-07-01T08:06:11Z
*** This issue has been marked as a duplicate of issue 6417 ***