[Issue 2938] New: incorrect code generated for assignment to assoc array element

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 4 21:31:39 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2938

           Summary: incorrect code generated for assignment to assoc array
                    element
           Product: D
           Version: 2.029
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: cristian at zerobugs.org


This code causes a range violation exception. It goes away if the postblit
operator is commented away.

The root cause is in the front-end which generates code that gets the element
at key zero (to create a temp as argument to opAssign). I was able to work
around it in my back-end for .NET, but then the assertion fails, because the
front-end does not generate the call to postblit.


struct X {
     int i;
     this(this) {
         ++i;
     }
}
void main() {
     X [int] xs;
     xs[0] = X();
     assert(xs[0].i == 1);
}


-- 



More information about the Digitalmars-d-bugs mailing list