struct postblit not called, but still destructed

monarch_dodra monarchdodra at gmail.com
Sun Jan 19 12:55:03 PST 2014


On Sunday, 19 January 2014 at 20:46:06 UTC, monarch_dodra wrote:
> I'll file it as an ER, and try to get Kenji on it.

https://d.puremagic.com/issues/show_bug.cgi?id=11952

As a workaround, it is usually recommended in the destructor to 
try to detect "initial state", and do nothing in such cases.

This is generally recommended anyways, since the .init state 
could mess up your count:

void main()
{
     //Scope
     {
         A a; //No increment count
     }//Destruction
     assert(A.count == 0); //Fails
}

I'd say disabling "this()" would help, but in this case, your 
example code still fails... I'll bump the report to bug because 
of this.


More information about the Digitalmars-d-learn mailing list