[Issue 17897] Postblit is not called for temporary structures in the function parameters
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Oct 13 13:39:57 UTC 2017
https://issues.dlang.org/show_bug.cgi?id=17897
Richard Cattermole <alphaglosined at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|INVALID |---
--- Comment #3 from Richard Cattermole <alphaglosined at gmail.com> ---
(In reply to Steven Schveighoffer from comment #2)
> Sorry, I didn't mean to commit so early.
>
> A postblit is not called for a move, which is done for rvalues being sent
> into a function:
snip
Except this isn't just a move.
No, the number of destructor calls must be equal to the number of
constructor/postblit calls. Otherwise reference counting types are not going to
work.
Postblit must be called in the given example.
Count: 1 - create
Count: 1 - fun call
Count: 0 - destructor (deallocate memory)
Count: segfault, memory has already been freed - destructor (deallocate memory)
Something is still wrong in the given example.
--
More information about the Digitalmars-d-bugs
mailing list