Given
#include <iostream>
using namespace std;
struct Test {
public:
Test() {
cout << "Default constructor" << endl;
}
Test(const Test &) {
cout << "Copy constructor" << endl;
}
};
int main() {
Test && t1 = Test();
}
Why is it that when t1 is initialized, the copy constructor of Test isn't used? From reading reference initialization it appears that object
is a temporary which should invoke copy-initialization. Or is this a class type expression? If that is the case can someone define what a class type expression is (I'm having a hard time googling that).