Sometimes it\'s wise to split complicated or long expressions into multiple steps, for example (the 2nd version isn\'t more clear, but it\'s just an example):
As juanchopanza said, the compiler cannot (at C++ level) violate the "as-if" rule; that is all transformations should produce a semantically equivalent code.
However, beyond the C++ level, when the code is optimized, further opportunities may arise.
As such, it really depends on the objects themselves: if the move-constructors/destructors have side effects, and (de)allocating memory is a side effect, then the optimization cannot occur. If you use only PODs, with default move-constructors/destructors, then it will probably be automatically optimized.