digitalmars.D.bugs - [Issue 14051] New: Invariant gets invoked after destruction for
- via Digitalmars-d-bugs (48/48) Jan 26 2015 https://issues.dlang.org/show_bug.cgi?id=14051
https://issues.dlang.org/show_bug.cgi?id=14051 Issue ID: 14051 Summary: Invariant gets invoked after destruction for structs with File members Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: bayan.rafeh92 gmail.com 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/ossuvfmqthllgdpgzntm forum.dlang.org --
Jan 26 2015