title: Does the following code invoke undefined behaviour?
body: <p>I would like to do something like this</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;memory&gt;
  
  struct Foo {};
  
  using FooPtr = std::unique_ptr&lt;Foo&gt;;
  
  FooPtr makeFoo() { return FooPtr(new Foo()); }
  
  struct Baz
  {
      Baz(FooPtr foo) : Baz(std::move(foo), bar(foo)) {}
      Baz(FooPtr foo, int something) : _foo{ std::move(foo) }, _something{ something } {}
  private:
      FooPtr _foo;
      int _something;
  
      static int bar(const FooPtr &amp; ptr)
      {
          std::cout &lt;&lt; "bar!" &lt;&lt; std::endl;
          return 42;
      }
  };
  
  int main() {
      Baz baz(makeFoo());
      return 0;
  }
  </code></pre>
  
  <p>My question is: the order of function argument evaluation is unspecified, so is it safe to pass a value that will be moved from in one argument, and the result of calling another function with the <strong>same instance</strong>, passed as reference-to-const, as the other argument?</p>
  
  <p>I think the question boils down to when, precisely, the actual move operation is performed, a point on which I'm not entirely clear (especially when it comes to having optimization turned on).</p>