#include <iostream>
using namespace std;
struct A {
A() { cout << "default" << endl; }
A(const A&) { cout << "copy" << endl; }
A(A&&) { cout << "move" << endl; }
};
int main() {
A a{};
auto aa = A{};
return 0;
}
This program will print default
, default
in MSVC2013. Does the standard say anything of creating an object with auto on the left side, or can the second version, auto aa = A{};
first call the default constructor and then move/copy the tmp variable to the left side?