If I'm not mistaken, you get default move constructors under certain conditions: no user-defined copy constructor + no user-defined destructor + all members are movable, or something like that. (This...
Type: Posts; User: anon
If I'm not mistaken, you get default move constructors under certain conditions: no user-defined copy constructor + no user-defined destructor + all members are movable, or something like that. (This...
A&& foo()
{
static A test(std::rand());
return std::move(test);
}
This function is also horribly broken.
1) If your test program shows two different values from foo, that's because...
You must not return references to locals, rvalue or not.
You return local variables by value, and in C++11 this will invoke move constructor/assignment - if the copy is not elided altogether.