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

           Summary: [CTFE] assignment to AA apply ref argument
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: d...@dawgfoto.de


--- Comment #0 from d...@dawgfoto.de 2012-03-28 22:11:30 PDT ---
struct Symbol
{
    size_t _id;
}

size_t foo(Symbol[string] tree)
{
    size_t i;
    foreach(k, ref v; tree)
        v._id = ++i; // has no effect
    return tree["a"]._id;
}

static assert(foo(["a":Symbol(0)]) == 1);

--------

The assignment to the ref value field has no effect.
Looks like the value literal is copied before calling the
foreach body.

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

Reply via email to