This code does not compile. But if I remove the explicit keyword from the move constructor then it works. Why?
struct Bar {
Bar() {}
explicit Bar(const Bar& x) {}
explicit Bar(Bar&& x) {}
};
Bar bar() {
Bar x;
return x;
}
The compilation error is:
error: no matching function for call to 'Bar::Bar(Bar&)'