[Issue 15848] out doesn't call opAssign()

2016-04-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15848

--- Comment #4 from Marc Schütz  ---
I don't feel strongly either way. But the specification is not clear IMO,
"initialized" could be understood as construction as well as a "first
assignment".

--


[Issue 15848] out doesn't call opAssign()

2016-03-30 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15848

Alex Parrill  changed:

   What|Removed |Added

 CC||initrd...@gmail.com

--- Comment #3 from Alex Parrill  ---
I don't think opAssign should be called here. Default initialization is not
assignment; declaring a variable does not call opAssign with T.init, it just
copies over T.init.

So the real issue is that `t`'s destructor is not being called when `foo(t)` is
ran.

--


[Issue 15848] out doesn't call opAssign()

2016-03-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15848

ag0ae...@gmail.com changed:

   What|Removed |Added

 CC||ag0ae...@gmail.com

--- Comment #2 from ag0ae...@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

--


[Issue 15848] out doesn't call opAssign()

2016-03-29 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15848

lasssa...@gmail.com changed:

   What|Removed |Added

 CC||lasssa...@gmail.com

--- Comment #1 from lasssa...@gmail.com ---
I'm not sure I follow: Why should opAssign be called?

--