title: Move assignment of vector of non-movable-non-copyable objects does not compile
body: <p>The following code does not compile with Visual Studio 2013:</p>
  
  <pre><code>#include &lt;vector&gt;
  
  struct X {
      X() = default;
      X(const X&amp;) = delete;
      X&amp; operator=(const X&amp;) = delete;
      X(X&amp;&amp;) = delete;
      X&amp; operator=(X&amp;&amp;) = delete;
      ~X() = default;
  };
  
  void foo()
  {
      std::vector&lt;X&gt; v;
      std::vector&lt;X&gt; w;
      w = std::move(v);
  }
  </code></pre>
  
  <p>The error message says</p>
  
  <pre><code>error C2280: 'X::X(X &amp;&amp;)' : attempting to reference a deleted function
  </code></pre>
  
  <p>That makes no sense to me. You should not need the move constructor for <code>X</code> in order to move a <code>vector&lt;X&gt;</code>. Is this a compiler bug, or am I missing something?</p>
  
  <p>Here is the complete error message:</p>
  
  <pre><code>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0(600): error C2280: 'X::X(X &amp;&amp;)' : attempting to reference a deleted function
      Test.cpp(9) : see declaration of 'X::X'
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0(723) : see reference to function template instantiation 'void std::allocator&lt;_Ty&gt;::construct&lt;_Objty,_Ty&gt;(_Objty *,_Ty &amp;&amp;)' being compiled
      with
      [
          _Ty=X
      ,   _Objty=X
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0(723) : see reference to function template instantiation 'void std::allocator&lt;_Ty&gt;::construct&lt;_Objty,_Ty&gt;(_Objty *,_Ty &amp;&amp;)' being compiled
      with
      [
          _Ty=X
      ,   _Objty=X
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0(872) : see reference to function template instantiation 'void std::allocator_traits&lt;_Alloc&gt;::construct&lt;_Ty,_Ty&gt;(std::allocator&lt;_Ty&gt; &amp;,_Objty *,_Ty &amp;&amp;)' being compiled
      with
      [
          _Alloc=std::allocator&lt;X&gt;
      ,   _Ty=X
      ,   _Objty=X
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0(872) : see reference to function template instantiation 'void std::allocator_traits&lt;_Alloc&gt;::construct&lt;_Ty,_Ty&gt;(std::allocator&lt;_Ty&gt; &amp;,_Objty *,_Ty &amp;&amp;)' being compiled
      with
      [
          _Alloc=std::allocator&lt;X&gt;
      ,   _Ty=X
      ,   _Objty=X
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory(378) : see reference to function template instantiation 'void std::_Wrap_alloc&lt;std::allocator&lt;_Ty&gt;&gt;::construct&lt;X,X&gt;(_Ty *,X &amp;&amp;)' being compiled
      with
      [
          _Ty=X
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory(378) : see reference to function template instantiation 'void std::_Wrap_alloc&lt;std::allocator&lt;_Ty&gt;&gt;::construct&lt;X,X&gt;(_Ty *,X &amp;&amp;)' being compiled
      with
      [
          _Ty=X
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory(416) : see reference to function template instantiation '_FwdIt std::_Uninit_copy&lt;_InIt,_FwdIt,std::allocator&lt;_Ty&gt;&gt;(_InIt,_InIt,_FwdIt,std::_Wrap_alloc&lt;std::allocator&lt;_Ty&gt;&gt; &amp;,std::_Nonscalar_ptr_iterator_tag)' being compiled
      with
      [
          _FwdIt=X *
      ,   _InIt=std::move_iterator&lt;std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;X&gt;&gt;&gt;&gt;
      ,   _Ty=X
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory(427) : see reference to function template instantiation '_FwdIt std::_Uninit_copy&lt;_Iter,X,_Alloc&gt;(_InIt,_InIt,_FwdIt,_Alloc &amp;)' being compiled
      with
      [
          _FwdIt=X *
      ,   _Iter=std::move_iterator&lt;std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;X&gt;&gt;&gt;&gt;
      ,   _Alloc=std::_Wrap_alloc&lt;std::allocator&lt;X&gt;&gt;
      ,   _InIt=std::move_iterator&lt;std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;X&gt;&gt;&gt;&gt;
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vector(1640) : see reference to function template instantiation '_FwdIt std::_Uninitialized_copy&lt;_Iter,X*,std::_Wrap_alloc&lt;std::allocator&lt;_Ty&gt;&gt;&gt;(_InIt,_InIt,_FwdIt,_Alloc &amp;)' being compiled
      with
      [
          _FwdIt=X *
      ,   _Iter=std::move_iterator&lt;std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;X&gt;&gt;&gt;&gt;
      ,   _Ty=X
      ,   _InIt=std::move_iterator&lt;std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;X&gt;&gt;&gt;&gt;
      ,   _Alloc=std::_Wrap_alloc&lt;std::allocator&lt;X&gt;&gt;
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vector(789) : see reference to function template instantiation 'X *std::vector&lt;X,std::allocator&lt;_Ty&gt;&gt;::_Ucopy&lt;_Iter&gt;(_Iter,_Iter,X *)' being compiled
      with
      [
          _Ty=X
      ,   _Iter=std::move_iterator&lt;std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;X&gt;&gt;&gt;&gt;
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vector(789) : see reference to function template instantiation 'X *std::vector&lt;X,std::allocator&lt;_Ty&gt;&gt;::_Ucopy&lt;_Iter&gt;(_Iter,_Iter,X *)' being compiled
      with
      [
          _Ty=X
      ,   _Iter=std::move_iterator&lt;std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;X&gt;&gt;&gt;&gt;
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vector(766) : see reference to function template instantiation 'void std::vector&lt;X,std::allocator&lt;_Ty&gt;&gt;::_Construct&lt;_Iter&gt;(_Iter,_Iter,std::forward_iterator_tag)' being compiled
      with
      [
          _Ty=X
      ,   _Iter=std::move_iterator&lt;std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;X&gt;&gt;&gt;&gt;
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vector(766) : see reference to function template instantiation 'void std::vector&lt;X,std::allocator&lt;_Ty&gt;&gt;::_Construct&lt;_Iter&gt;(_Iter,_Iter,std::forward_iterator_tag)' being compiled
      with
      [
          _Ty=X
      ,   _Iter=std::move_iterator&lt;std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;X&gt;&gt;&gt;&gt;
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vector(854) : see reference to function template instantiation 'void std::vector&lt;X,std::allocator&lt;_Ty&gt;&gt;::_Construct&lt;std::move_iterator&lt;std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;X&gt;&gt;&gt;&gt;&gt;(_Iter,_Iter)' being compiled
      with
      [
          _Ty=X
      ,   _Iter=std::move_iterator&lt;std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;X&gt;&gt;&gt;&gt;
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vector(854) : see reference to function template instantiation 'void std::vector&lt;X,std::allocator&lt;_Ty&gt;&gt;::_Construct&lt;std::move_iterator&lt;std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;X&gt;&gt;&gt;&gt;&gt;(_Iter,_Iter)' being compiled
      with
      [
          _Ty=X
      ,   _Iter=std::move_iterator&lt;std::_Vector_iterator&lt;std::_Vector_val&lt;std::_Simple_types&lt;X&gt;&gt;&gt;&gt;
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vector(849) : while compiling class template member function 'void std::vector&lt;X,std::allocator&lt;_Ty&gt;&gt;::_Assign_rv(std::vector&lt;_Ty,std::allocator&lt;_Ty&gt;&gt; &amp;&amp;,std::false_type)'
      with
      [
          _Ty=X
      ]
      C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\vector(860) : see reference to function template instantiation 'void std::vector&lt;X,std::allocator&lt;_Ty&gt;&gt;::_Assign_rv(std::vector&lt;_Ty,std::allocator&lt;_Ty&gt;&gt; &amp;&amp;,std::false_type)' being compiled
      with
      [
          _Ty=X
      ]
      Test.cpp(16) : see reference to class template instantiation 'std::vector&lt;X,std::allocator&lt;_Ty&gt;&gt;' being compiled
      with
      [
          _Ty=X
      ]
  </code></pre>