www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6726] New: DMD crash with index in foreach statement

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6726

           Summary: DMD crash with index in foreach statement
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



16:46:02 PDT ---
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) { }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 24 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6726


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE



16:55:14 PDT ---
*** This issue has been marked as a duplicate of issue 6723 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 24 2011