std::move() does not move a constant of a class type
Roman Kononov
roman@binarylife.net
Sun Nov 28 17:50:00 GMT 2010
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
More information about the Gcc
mailing list