[Issue 1886] New: Inserting into an AA of structs with opAssign results in ArrayBoundsError

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 2 10:09:20 PST 2008


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

           Summary: Inserting into an AA of structs with opAssign results in
                    ArrayBoundsError
           Product: D
           Version: 2.011
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: ludwig at informatik.uni-luebeck.de


Inserting into an associative array with structs as value types results in a
runtime error, as soon as the struct defines an opAssign. Structs without
opAssign work fine.

The code below will abort at runtime with an ArrayBoundsError exception:

-----------------
struct S {
        void opAssign( in S s ){}
}

int main()
{
        S[string] aa;
        aa["test"] = S(); // throws ArrayBoundsError

        return 0;
}
-----------------
Error: ArrayBoundsError bug_aaassign.d(8)


-- 



More information about the Digitalmars-d-bugs mailing list