On Friday, 30 November 2012 at 03:27:57 UTC, Walter Bright wrote:
Frankly, non-trivial default construction has always smelled like a bad practice to me, though it's not always obvious why.



If that's the case, then we need to get rid of postblits entirely.

They don't make sense if default-valued structs are meant to be bit-copyable.

Consider:

size_t n;

struct S { this(this) { n++; } }

void main()
{
        auto s1 = S();
        auto s2 = S.init;
        const s3 = const(S)();
        immutable s4 = immutable(S)();
        enum s5 = S();

        auto t1 = s1;
        auto t2 = s2;
        auto t3 = s3;
        auto t4 = s4;
        auto t5 = s5;

        // What's 'n' supposed to be now, and why?
}

Reply via email to