Такой простой пример:
http://ideone.com/LCNVpe
struct A
{
A() = default;
A(const A&) = default;
A(A&&) = delete;
};
A foo(const A& a) { return a; } // (1) success: use of the copy constructor
A foo(A&& a) { return a; } // (2) success: use of the copy constructor
A foo(A a) { return a; } // (3) error: use of deleted function 'A::A(A&&)'
A foo() { A a; return a; } // (4) error: use of deleted function 'A::A(A&&)'
int main()
{
}
Не могу взять в толк, почему в 3-м и 4-м случаях он не может обойтись копированием, а требует move конструктор?