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

<p>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.</p>