On Thursday, 9 May 2013 at 13:00:44 UTC, Steven Schveighoffer
wrote:
I have no problem with ref const accepting rvalues. As I
understand it, Andrei's objection (and this may be
wrong/incomplete) is that then there is no way to say you
accept only lvalues as const ref and rvalues via non-ref (for
performance reasons). But I think there is no technical reason
preventing that with D.
Binding rvalues to ref is also dangerous, because the lifetime of
the rvalue is separate from that of the ref, and the ref has no
way of knowing when the rvalue will be destroyed.
The ref safety proposal will make it a runtime error to return a
reference to a destroyed object, but it would be better if we
reduced the opportunities for runtime errors if possible.