[Bug c++/77733] New: Add fixit hint suggesting to use std::move
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Sep 25 20:12:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77733
Bug ID: 77733
Summary: Add fixit hint suggesting to use std::move
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
struct X { };
struct Y {
void foo();
void foo(X&&);
void foo(int, const X&);
void foo(int, X&&);
};
int main()
{
X x;
Y y;
y.foo(x);
}
Produces the error:
move.cc: In function ‘int main()’:
move.cc:14:10: error: cannot bind rvalue reference of type ‘X&&’ to lvalue of
type ‘X’
y.foo(x);
^
move.cc:5:8: note: initializing argument 1 of ‘void Y::foo(X&&)’
void foo(X&&);
^~~
It would be useful to suggest using std::move(x) instead.
More information about the Gcc-bugs
mailing list