Confusion regarding struct lifecycle
Matt Elkins via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Feb 16 18:44:04 PST 2016
On Wednesday, 17 February 2016 at 02:23:52 UTC, Ali Çehreli wrote:
> Since a static array must consist of .init values to begin
> with, every move into its members must also trigger its
> destructor if the type has elaborate destructor.
Oof. This strikes me as a "gotcha", that this happens even with
@disable this() as opposed to a compiler error. Is this only for
static arrays, or are there other places @disable this() is
silently ignored?
> This is what I've discovered:
Ok, I think that pretty much explains the behavior I was seeing
in the reduced case. Thanks -- that's helpful to know!
The downside is that it really indicates that I didn't reduce my
buggy program properly. I'll hold out for the
live-object-destructor-call fix to see whether that corrects my
problem; I can just leak resources until then :).
More information about the Digitalmars-d-learn
mailing list