[Issue 14321] New: No postblit call with struct and AA's

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Mar 23 04:03:04 PDT 2015


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

          Issue ID: 14321
           Summary: No postblit call with struct and AA's
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: rswhite4 at gmail.com

Code:
----
import std.stdio;

struct Foo {
    this(int id) {
        writeln("CTor");
    }

    this(this) {
        writeln("Postblit");
    }

    ~this() {
        writeln("DTor");
    }
}

void main() {
    Foo[string] foos;
    foos["test"] = Foo(42);

    writeln("end of main");
}
----

Expected behaviour
----
CTor
end of main
----

or

----
CTor
Postblit
DTor
end of main
----

But currently:
----
CTor
DTor
end of main
----

That ruins all interaction between AA's and ref counted structs.

--


More information about the Digitalmars-d-bugs mailing list