Thread overview
[Issue 24820] Associative arrays do not correctly handle keys with copy constructors
October 18
https://issues.dlang.org/show_bug.cgi?id=24820

--- Comment #1 from Jonathan M Davis <issues.dlang@jmdavisProg.com> ---
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.

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

--- Comment #2 from Jonathan M Davis <issues.dlang@jmdavisProg.com> ---
It looks like the AA implementation currently has a test to verify that it handles postblits correctly. Presumably, that could be copied and reworked to verify that copy constructors get called correctly:

https://github.com/dlang/dmd/blob/master/druntime/src/rt/aaA.d#L935

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

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/17487

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--