This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/77733] New: Add fixit hint suggesting to use std::move
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 25 Sep 2016 20:12:40 +0000
- Subject: [Bug c++/77733] New: Add fixit hint suggesting to use std::move
- Auto-submitted: auto-generated
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.