-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document binary operator argument passing conventions #7777
Comments
I think this is working as intended. & patterns move out as they are evaluating into the destination if a new binding. * expressions alone (not targeting an assignment) don't. Maybe this requires clarification wrt expression evaluation rules and destination passing style? |
@graydon: Wait, shouldn't moving out of a |
@Kimundi it's legal for implicitly copyable types, because the move becomes a copy. |
Well sure, but then there should still be no difference between |
@Kimundi yes, but that isn't the case here. The expression interacts with autoref/deref and so complicates things. |
This is working as intended. Binary operators implicitly pass their arguments "by reference", so writing _x * *y is equivalent to |
Reopening and repurposing as a bug to improve documentation. I'm not sure whether this is documented or not, but I'd assume not. |
Nominating. |
closing in favor of #10337 |
This works:
But this doesn't:
The above
&t: &T
pattern could cut down on tons of repetitive derefs within function bodies.The text was updated successfully, but these errors were encountered: