[Issue 5931] keyword new insists on calling a struct's (non-zero argument) constructor--in other words, it won't allow default initialization; also postblit this(this) constructor dosen't get called from "new <structname>(<struct_instance>)"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 6 01:49:57 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5931


kennytm at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kennytm at gmail.com


--- Comment #2 from kennytm at gmail.com 2011-05-06 01:46:03 PDT ---
Post-blit is only called when you override the whole structure, as in:

----------------------------------------
import std.stdio;

struct S {
    this(this) {
        writeln("postblit");
    }
}

void main() {
    S s;
    S t;
    s = t;    // <-- call postblit on s.
}
----------------------------------------

Pointer-assignment will *not* call post-blit as you have not blitted
(memcpy-ed) anything.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list