Why is this copy constructor called rather than the move constructor?
The following code snippet causes the copy constructor to be called where I expected the move constructor to be called: #include <cstdio> struct Foo { Foo() { puts("Foo gets built!"); } Foo(const Foo& foo) { puts("Foo gets copied!"); } Foo(Foo&& foo) { puts("Foo gets moved!"); } }; struct Bar { Foo foo; }; Bar Meow() { Bar bar; return bar; } int main() { Bar bar(Meow()); } On VS11 Beta, in debug mode, this prints: Foo gets built! Foo gets copied! Foo gets copied! I checked the standard and Bar seems to meet all requirements to have a default move constructor automatically generated, yet that