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

ag0aep6g <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |---

--- Comment #8 from ag0aep6g <[email protected]> ---
(In reply to RazvanN from comment #7)
> Although it is not clearly stated, the way I read it is that the compiler
> simply blits T.init over the argument and then it passes a reference to it.
> No copy constructor and no assignment operator are called. Therefore, the
> destructor is called only for `t` to destroy the object in the main function.
> 
> This is correct behavior and much more efficient as it avoids a copy
> constructor/assignment call and a destructor call.
> 
> I'm going to tentatively close this as WORKSFORME. But please reopen if I am
> missing something.

Reopening. It's *because* no copy constructor and no assignment operator are
being called that the destructor must  be called.

You can't just blit T.init over an existing value without calling its
destructor first.

By the way, if the observed behavior were correct, the proper status to close
this would be INVALID. WORKSFORME is when you cannot reproduce the described
behavior.

--

Reply via email to