The Standard provides an example regarding to the a move constructor. There is what it says:
A non-template constructor for class
Xis a move constructor if its first parameter is of typeX&&,const X&&,volatile X&&, orconstvolatile X&&, and either there are no other parameters or else all other parameters have default arguments (8.3.6).
I was trying to run some an experiments with an example the Stadard provides:
#include <iostream> #include <limits> struct Y { Y(){ std::cout << "Y()" << std::endl; }; Y(const Y&){ std::cout << "Y(const Y&)" << std::endl; }; Y(Y&&){ std::cout << "Y(const Y&&)" << std::endl; }; }; Y f(int) { return Y(); } Y d(f(1)); // calls Y(Y&&) Y e = d; // calls Y(const Y&) int main(){ } But instead copy constructor was called. Why that?