www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2675] New: cannot foreach structs with copy constructor

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

           Summary: cannot foreach structs with copy constructor
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: andrei metalanguage.com


This code fails to comple with the message "Error: e2ir: cannot cast from void
to A".

struct A
{
    this(this)
    {
        writeln("B's copy");
    }
    bool empty() {return false;}
    void next() {}
    int head() { return 1; }
}

void main()
{
    A a;
    foreach (e; a) {}
}


-- 
Feb 18 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2675


bugzilla digitalmars.com changed:

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




------- Comment #1 from bugzilla digitalmars.com  2009-03-11 14:58 -------
Fixed dmd 2.026


-- 
Mar 11 2009