This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]