title: std::vector initialization move/copy constructor of the element
body: <p>I have this piece of code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  using namespace std;
  
  class Foo{
  public:
      Foo() noexcept {cout &lt;&lt; "ctor" &lt;&lt; endl;}
      Foo(const Foo&amp;) noexcept {cout &lt;&lt; "copy ctor" &lt;&lt; endl;}
      Foo(Foo&amp;&amp;) noexcept {cout &lt;&lt; "move ctor" &lt;&lt; endl;}
  
      Foo&amp; operator=(Foo&amp;&amp;) noexcept {cout &lt;&lt; "move assn" &lt;&lt; endl; return *this;}
      Foo&amp; operator=(const Foo&amp;) noexcept {cout &lt;&lt; "copy assn" &lt;&lt; endl; return *this;}
  
      ~Foo() noexcept {cout &lt;&lt; "dtor" &lt;&lt; endl;}
  };
  
  
  int main()
  {   
      Foo foo;
  
      vector&lt;Foo&gt; v;
      v.push_back(std::move(foo)); 
  
      // comment the above 2 lines and replace by
      // vector&lt;Foo&gt; v{std::move(foo)}; 
  }
  </code></pre>
  
  <p>The output is what I expect (compiled with <code>g++ -std=c++11 --no-elide-constructors</code>, same output without the flag)</p>
  
  <pre><code>ctor
  move ctor
  dtor
  dtor
  </code></pre>
  
  <p>Now instead of using <code>push_back</code> initialize directly the vector <code>v</code> as</p>
  
  <pre><code>vector&lt;Foo&gt; v{std::move(foo)};
  </code></pre>
  
  <p>I do not understand why I get the outputs:</p>
  
  <p>1) (without <code>--no-elide-constructors</code>)</p>
  
  <pre><code>ctor
  move ctor
  copy ctor
  dtor
  dtor
  dtor
  </code></pre>
  
  <p>2) (with <code>--no-elide-constructors</code>)</p>
  
  <pre><code>ctor
  move ctor
  move ctor
  copy ctor
  dtor
  dtor
  dtor
  dtor
  </code></pre>
  
  <p>In the first case, why is the copy ctor invoked? And in the second case, when the compiler does not perform elision, I have absolutely no idea why the move ctor is invoked twice. Any ideas? </p>