[Issue 2451] Adding structs that use opAssign or postblit to an AA is broken

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 22 07:15:17 PDT 2010


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



--- Comment #5 from Don <clugdbug at yahoo.com.au> 2010-05-22 07:15:10 PDT ---
I don't have a patch for this, but the direct reason for the observed behaviour
is in expression.c, line 9023. If the type being inserted has an opAssign
overload, then it drops out of AssignExp::semantic() immediately and discards
the rest of the expression.
This isn't a real patch, since it still doesn't call postblit.

    /* If it is an assignment from a 'foreign' type,
     * check for operator overloading.
     */
    if (t1->ty == Tstruct)
    {
        StructDeclaration *sd = ((TypeStruct *)t1)->sym;
        if (op == TOKassign)
        {
            Expression *e = op_overload(sc);

+            if (e1->op==TOKindex &&
+                ((IndexExp *)e1)->e1->type->toBasetype()->ty == Taarray)
+            {
+            // If it is an AA, the assignment 
+            // should be treated as a function call (Bugzilla 2451)
+            }
+            else
             if (e)
                return e;
        }

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


More information about the Digitalmars-d-bugs mailing list