[Issue 519] Invariant not called from autogenerated class/struct constructor/destructor

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Jan 15 02:18:44 PST 2015


https://issues.dlang.org/show_bug.cgi?id=519

--- Comment #17 from Martin Nowak <code at dawg.eu> ---
(In reply to Andrei Alexandrescu from comment #16)
> I stated this elsewhere, just making sure I don't forget: probably we don't
> want to invoke invariants during the GC cycle.

Walter has a different opinion on this, I don't follow his argument though.
http://forum.dlang.org/post/m753hk$pt2$1@digitalmars.com

Currently it can't be done, because the calls to the invariant are embedded
into the generated destructor function.

Also the invariant is called twice, before and after running the destructor.
The latter forces one to perform additional cleanup, e.g. setting pointers to
null.

--


More information about the Digitalmars-d-bugs mailing list