[Issue 17897] Incorrect number of destructor calls in example

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 26 14:10:33 UTC 2017


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

--- Comment #11 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to Temtaime from comment #10)
> After fixing https://issues.dlang.org/show_bug.cgi?id=17246 this outputs:
> 
> Bar.this(int): 14FB84
> fun: 14FB20
> Bar.~this(): 14FB20
> 
> Object gets moved without notification.
> This should not behave this way

This is perfectly valid. You are allowed to move a struct without calling the
postblit. See the spec here: https://dlang.org/spec/struct.html

"A struct is defined to not have an identity; that is, the implementation is
free to make bit copies of the struct as convenient."

In fact, I think we can close this as a duplicate, as it now works properly.

However, I'm kind of surprised there is a move here, should be unnecessary if
implemented properly.

--


More information about the Digitalmars-d-bugs mailing list