'return this' allows binding rvalues to references

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Apr 8 11:25:17 PDT 2013


On 4/8/13 2:18 PM, Steven Schveighoffer wrote:
> Essentially, the compiler turns a blind eye when passing rvalues by
> reference if binding to this. It's kind of unavoidable, to prevent it
> would be a major pain point, since simple accessors should easily be
> able to be called on rvalues, and you can't remove the 'ref' of 'this'.
>
> I recall in the past, Andrei wishes to remove that possibility (maybe
> I'm wrong), but I think it would be too impractical.

Yes, that's a major hole. I'm mulling over a technique that fixes the 
general issue while not breaking much code.

Andrei




More information about the Digitalmars-d mailing list