https://issues.dlang.org/show_bug.cgi?id=15848
RazvanN <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |[email protected] Resolution|--- |WORKSFORME --- Comment #7 from RazvanN <[email protected]> --- I think that the behavior exhibited here is correct. The spec for out parameters says: "The argument must be an lvalue, which will be passed by reference and initialized upon function entry with the default value (T.init) of its type." 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. --
