[Issue 15848] out doesn't call opAssign()
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Mar 29 11:56:56 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=15848
ag0aep6g at gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ag0aep6g at gmail.com
--- Comment #2 from ag0aep6g at gmail.com ---
(In reply to lasssafin from comment #1)
> I'm not sure I follow: Why should opAssign be called?
Either a new Test is constructed by foo, but then the destructor should be
called on the old Test. Or the existing Test is used, but then opAssign should
be called instead of just writing Test.init over the old value.
I think the spec [1] is rather clear about which one should happen:
> out parameter is initialized upon function entry with the default value for its type
So I think the destructor should be called.
1 http://dlang.org/spec/function.html#parameters
--
More information about the Digitalmars-d-bugs
mailing list