You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] No implicit move or forward on last use in initialization #749
Thanks! Repeating rationale here from #792 comment thread: The issue is that I was trying out suppressing move-from-last-use if the last use was in an initializer, because of examples like view: std::span = local_variable; when that was the last use of local_variable, which is an error for an rvalue. But that also suppresses a righteous move in examples like result := local_variable;. So I now agree those should be treated as rvalues too, and if that causes an error for an rvalue because there is no further us of that variable in scope, then the programmer must write an explicit discard of the variable.
Activity
hsutter commentedon Nov 14, 2023
Thanks! Repeating rationale here from #792 comment thread: The issue is that I was trying out suppressing move-from-last-use if the last use was in an initializer, because of examples like
view: std::span = local_variable;when that was the last use oflocal_variable, which is an error for an rvalue. But that also suppresses a righteous move in examples likeresult := local_variable;. So I now agree those should be treated as rvalues too, and if that causes an error for an rvalue because there is no further us of that variable in scope, then the programmer must write an explicit discard of the variable.Re-enable move from last use in initializers, closes hsutter#749
Re-enable move from last use in initializers, closes hsutter#749