On Friday, 13 November 2015 at 17:25:44 UTC, rsw0x wrote:
afaik that's RVO, isn't it?
D's RVO semantics are pretty much unspecified still(outside of dmd,) I believe(don't quote me) that walter said it's supposed to be part of the spec but I could never find anything.

Well, RVO is used when the value being returned is a local variable. The compiler knows that it can be moved rather than copied, so it's moved. However, the this pointer/reference isn't a local variable. It's a member variable. So, it can't be moved. So, RVO shouldn't kick in when returning this.

- Jonathan M Davis

Reply via email to