On Saturday, 7 February 2015 at 14:46:55 UTC, Daniel Murphy wrote:
NRVO isn't required for correct semantics, as structs can be
moved with bitcopy.
Yes, you're right. I suppose what I mean is that it should be
guaranteed that returning a local Lvalue by value should always
be moved to the caller destination, rather than copied then
destroyed.
S foo() {
S s;
return s;
}
S s = foo(); // no destructors or postblits should be called here
The spec needs to guarantee this, otherwise unary
std.algorithm.move isn't guaranteed to work for non-copyable
types.