On Friday, 20 July 2012 at 16:02:18 UTC, Namespace wrote:
If i @disable the postblit i get a strange behaviour:
[code]
struct Test {
public:
int _id;
this(int i) {
_id = i;
writeln("CTOR");
}
@disable
this(this);
~this() {
writeln("DTOR");
}
}
void main() {
Test[] _arr;
_arr ~= Test(42);
writeln(_arr[0]._id);
writeln("end main");
}
[/code]
prints:
CTOR
DTOR
42
end main
The DTor is called _before_ i write Test's id but i can still
print the correct id.
Implicit Copy CTor? ;)
Array appending and struct postblit behavior is now broken.
I've suggested a pull request to fix these bugs.
https://github.com/D-Programming-Language/dmd/pull/1037
Bye.
Kenji Hara