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

--- Comment #0 from 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:
------- You are receiving this mail because: -------

Reply via email to