Comment #0 by bayan.rafeh92 — 2015-01-26T15:52:39Z
When a class with a File as a member of the class, the invariant block gets invoked incorrectly, twice before destruction and once after destruction.
An example code snippet:
// Written by Ali Çehreli
import std.stdio;
void main(){
writeln("entered main");
auto a = new A();
writeln("leaving main");
}
class A {
File file;
this() {
writeln("this");
}
~this() {
writeln("~this");
}
invariant() {
writeln("invariant");
}
}
The previous code produces the following output:
entered main
this
invariant
leaving main
invariant
invariant <-- ?
~this
invariant <-- ?
The forum thread where this issue was found:
http://forum.dlang.org/thread/[email protected]