> I suppose you propose to automatically forward the variable at the last use and not before?
No, it would always forward. Remember: forwarding doesn't do anything
in and of itself. What does something is how the recipient of the
forwarding process uses it.
But forwarding moves from your variable in half the cases, so that's not quite correct?
But the meaning of a piece of syntax
should not change based on where it is in a function or what follows
Why not, if this does what you want in most cases? At least correct behavior is guaranteed, and it's an easy to understand, observable mechanism.
Signature of functions can be hard to track down, if my rvalue-ref is moved automatically on the first rvalue/forwarding-ref signature it means that we now have to lvalue-ref-cast every use before the last or else an unfortunate overload can silently break the code. A special operation on last use is actually a more observable process.
This is also why we shouldn't allow implicit moves on the last use of
a local variable in a function, even if a move operation was available
to that usage. `return name` is OK to move from because that statement
will *always* be the last thing executed in the function no matter
where it appears relative to other code. But moving code around
shouldn't affect the behavior in terms of overload resolution and the
The bigger problem with implicit moves is that it effectively changes your program in ways that are hard to predict. If your object destructor has side-effects and your code depends on it being called at the end of X function scope, that's a bug (still going to be called, but with another state).
This kind of type is fairly rare though and i would be ok with opt-in implicit moves. "Pass the data in the most efficient way for the last use if an overload is found" is a simple enough rule - and i think code that performs semantically differently depending on reference qualifiers isn't the kind of code to base language design decisions on. Furthermore you still could get manual control by performing decay-copy etc, but that would be "typing more to do the special case" instead of "typing more to do the obvious thing".