Postblit not called in one case

bearophile bearophileHUGS at lycos.com
Tue Jul 5 18:43:46 PDT 2011


With DMD 2.053 the second assert of this program fires, is this a DMD bug or it's me that's missing something?


struct Foo {
    int[] data;

    this(int n) {
        data.length = n;
    }

    this(this) {
        data = data.dup;
    }
}
void main() {
    Foo f1, f2;
    f1 = Foo(1);
    f2 = f1;
    assert(f1.data.ptr != f2.data.ptr); // OK
    f1 = f2 = Foo(1);
    assert(f1.data.ptr != f2.data.ptr); // asserts
}

Bye and thank you,
bearophile


More information about the Digitalmars-d-learn mailing list