On 04/08/2012 02:14 PM, Kevin Cox wrote:

On Mar 26, 2012 5:11 AM, "Benjamin Thaut" <c...@benjamin-thaut.de
<mailto:c...@benjamin-thaut.de>> wrote:
 > Is this intended behaviour or is this a bug? I assume this happens
because of the mixin template and the public import.
 > I'm using dmd 2.058.
 >
 > --
 > Kind Regards
 > Benjamin Thaut

I don't think the order of destructors is defined. There would be no way
to have semantic control because it wouldn't work when you link
different files together.  The only solution would be to have the
compiler analyse the code and figure out what should be destructed first
which would be and impressive feat.


Actually that is what is normally done. (it is quite conservative though, cyclical imports where multiple modules have static constructors/destructors are just disallowed and terminate the program on startup.)

The solution to solving your problem is not to close the file object in
the destructor and let the OS clean it up when your program terminates.


This would be a workaround.

Reply via email to