title: C++: should I explicitly use std::move() in a return statement to force a move?
body: <p><strong>EDIT</strong>: it is NOT a duplicate because this question asks about a compiler's decision in O0.</p>
  
  <p>It is said <a href="https://stackoverflow.com/a/12953129/8385554">here</a> that Name Return Value Optimization (NRVO) is an optimization many compiler support. But is it a must or just a nice-to-have optimization?</p>
  
  <p>My situation is, I want to compile with <code>-O0</code> (i.e. no optimization), for convenience of debugging, but I also want NRVO to be enabled for return statements that return objects (say, a vector). If NRVO is not a must, the compiler probably won't do it in <code>-O0</code> mode. In this case, should I prefer this code:</p>
  
  <pre><code>std::vector&lt;int&gt; foo() {
      std::vector&lt;int&gt; v(100000,1); // an object that is really big..
      return std::move(v);  // explicitly move
  }
  </code></pre>
  
  <p>over this below?</p>
  
  <pre><code>std::vector&lt;int&gt; foo() {
      std::vector&lt;int&gt; v(100000,1);
      return v;    // copy or move?
  }
  </code></pre>
  
  <p>EDIT: the compiler I am using is GCC6, but I want the code to be compiler-independent.</p>