Closed
Description
In changing code to prepare for #2633, I'm noticing that most of the "copying a noncopyable" errors when I disable last-use have to do with a return
, usually a return of a local variable. I propose that a return x
should, by default, mean return (move x)
when x
is an owned lvalue. This avoids the need to insert lots of explicit move
s once last-use is disabled.
An argument against this proposal is that the point of #2633 is to make more things explicit, and this proposal makes more things implicit again. However, I think it's easier to understand that "return is move" when you're returning something you own than it is to understand how last-use works.