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

           Summary: [qtd] AA element assignment should use
                    copy-constructor to initialize new elements
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: samu...@voliacable.com


--- Comment #0 from Max Samukha <samu...@voliacable.com> 2010-11-18 08:23:00 
PST ---
Currently opAssign is called on newly created AA elements of struct types. This
leaves us absolutely no possibility to properly initialize AA elements without
introducing costly and unreliable checks in opAssign:

struct QString
{
    ref QString opAssign(ref QString other)
    {
        if (memcmp(cast(void*)&this, cast(void*)&T.init, sizeof(this)) == 0)
        {
            // construct copy
        }
        else
        {
            // assign
        }
    }
}

QString[int] ss;
QString s = qs("some string");
ss[0] = s;

Can AA be modified so that new elements are initialized with the
copy-constructor (as they should be) and not opAssign?

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

Reply via email to