https://issues.dlang.org/show_bug.cgi?id=24820

--- Comment #1 from Jonathan M Davis <[email protected]> ---
FYI, opAssign should have been

```
    void opAssign()(auto ref S rhs)
    {
        writefln("Assigning %s, count(%s) to %s, count(%s)",
                 rhs.i, rhs.count, this.i, this.count);

        if(this.count)
        {
            ++this.count.assignedTo;
            --this.count.refCount;
        }

        if(rhs.count)
        {
            ++rhs.count.assignedFrom;
            ++rhs.count.refCount;
        }

        this.count = rhs.count;
        this.i = rhs.i;
    }

```

I screwed it up and mutated this.count instead of rhs.count in the rhs.count
section, but it doesn't actually get triggered with what main is doing, so it
doesn't really matter. The example has more than is strictly necessary to show
the bug, because I was trying to show exactly what was going on without knowing
for sure which operations the AA would be using.

--

Reply via email to