On 8/22/17 7:50 AM, Jonas Mminnberg wrote:
Because of D's static initialization of members, this assert fails:

class Test {
     ubyte[] buf = new ubyte[1000];
}

void main() {
     auto a = new Test();
     auto b = new Test();
     assert(a.buf.ptr != b.buf.ptr);
}

This is bad, since;
* It is not how C++ works
* It introduces silent sharing of data
* It's usually not what you want

Shouldn't this at least generate a warning, or ideally not be allowed?


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

-Steve

Reply via email to