class X {
public:
X() {}
X(const X&) {
std::cou << "copy constructor";
}
X(X&&) {
std::cout << "move constructor";
}
};
X func() { return X(); }
int main() {
X x(func()); // nothing is printed
}
I think that the move constructor must be called, but neither copy constructor nor move constructor gets called. Is this because of copy ellision?