Skip to content

Instantly share code, notes, and snippets.

@Veedrac
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Veedrac/6abe18505d4ed174983b to your computer and use it in GitHub Desktop.
Save Veedrac/6abe18505d4ed174983b to your computer and use it in GitHub Desktop.
cpp.cpp:44:18: error: non-const lvalue reference to type 'X' cannot bind to a temporary of type
'typename std::remove_reference<X &>::type' (aka 'X')
swap(std::move(other));
^~~~~~~~~~~~~~~~
cpp.cpp:8:22: note: passing argument to parameter 'other' here
void swap(X& other) noexcept
^
cpp.cpp:65:18: error: non-const lvalue reference to type 'X' cannot bind to a temporary of type
'typename std::remove_reference<X &>::type' (aka 'X')
swap(std::move(rhs));
^~~~~~~~~~~~~~
cpp.cpp:8:22: note: passing argument to parameter 'other' here
void swap(X& other) noexcept
^
2 errors generated.
cpp.cpp: In constructor ‘X::X(X&&)’:
cpp.cpp:44:27: error: invalid initialization of non-const reference of type ‘X&’ from an rvalue of type ‘std::remove_reference<X&>::type {aka X}’
swap(std::move(other));
^
cpp.cpp:8:14: note: initializing argument 1 of ‘void X::swap(X&)’
void swap(X& other) noexcept
^
cpp.cpp: In member function ‘X& X::operator=(X&&)’:
cpp.cpp:65:27: error: invalid initialization of non-const reference of type ‘X&’ from an rvalue of type ‘std::remove_reference<X&>::type {aka X}’
swap(std::move(rhs));
^
cpp.cpp:8:14: note: initializing argument 1 of ‘void X::swap(X&)’
void swap(X& other) noexcept
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment