Bug 6726 – DMD crash with index in foreach statement
Status
RESOLVED
Resolution
DUPLICATE
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-09-24T16:46:00Z
Last change time
2011-09-24T16:55:14Z
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2011-09-24T16:46:02Z
Heavily reduced test-case (so the snippet might not make sense), originally from CairoD:
struct ItemRange
{
@property int front() { return 0; }
}
void main()
{
ItemRange range;
foreach (index, element; range)
{
}
}
---------------------------
dmd.exe - Application Error
---------------------------
The instruction at "0x0045b065" referenced memory at "0x00000010". The memory could not be "read".
Click on OK to terminate the program
Click on CANCEL to debug the program
---------------------------
OK Cancel
---------------------------
Using DMD 2.055 on XP32.
Removing index from foreach prevents the crash:
foreach (element; range) { }
Comment #1 by andrej.mitrovich — 2011-09-24T16:55:14Z
*** This issue has been marked as a duplicate of issue 6723 ***