On 04/04/2016 09:36 AM, Anonymouse wrote:
On Monday, 4 April 2016 at 03:55:26 UTC, Yuxuan Shui wrote:
On Monday, 4 April 2016 at 03:28:01 UTC, Yuxuan Shui wrote:
auto clobber(ref Set x, ref Set o) {
    Set ret;
    ret.aa = x.aa;
        assert(x.aa.length > 0);  // <-- boom
    return ret;
}

No idea myself but that's where it seems to go wrong.

Looks like a bug. Just to make it more visible:

auto clobber(ref Set x, ref Set o) {
    writefln("entered clobber    - x.aa: %s", x.aa);
    Set ret;
    writefln("did not touch x.aa - x.aa: %s", x.aa);
    ret.aa = x.aa;
    return ret;
}

x.aa changes during the second call:

entered clobber    - x.aa: [1:true]
did not touch x.aa - x.aa: [1:true]
entered clobber    - x.aa: [1:true]
did not touch x.aa - x.aa: []          <-- What happened?

Ali

Reply via email to