DIP 1016--ref T accepts r-values--Formal Assessment

Steven Schveighoffer schveiguy at gmail.com
Mon Jan 28 22:23:28 UTC 2019


On 1/28/19 2:58 PM, Andrei Alexandrescu wrote:
> TL;DR: it could be argued that the only dangerous conversions are lvalue 
> -> temp rvalue -> ref, so only disable those. The conversion rvalue -> 
> temp rvalue -> ref is not dangerous because the starting value on the 
> caller side could not be inspected after the call anyway.

I agree with you. It's one thing for the caller to pass in an rvalue 
that can clearly no longer be accessed. It's another thing to pass in an 
lvalue and have it "update" a temporary instead.

I already see this kind of bug all the time with alias this.

-Steve


More information about the Digitalmars-d-announce mailing list