This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
std::move() does not move a constant of a class type
- From: Roman Kononov <roman at binarylife dot net>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 27 Nov 2010 18:13:31 -0600
- Subject: std::move() does not move a constant of a class type
Hello,
Is it a bug or am I missing something?
$ cat test.cpp
#include <memory>
struct X {
X()=default;
X(X&&)=default;
};
X test() {
X const a={};
return std::move(a);
}
$ g++ -c -std=c++0x test.cpp
test.cpp: In function 'X test()':
test.cpp:10:22: error: no matching function for call to 'X::X(std::remove_reference<const X&>::type)'
test.cpp:5:4: note: candidates are: constexpr X::X(X&&)
test.cpp:4:4: note: constexpr X::X()
This is v4.6. v4.5 is happy here.
Thanks