title: std::vector::push_back() doesn't compile on MSVC for an object with deleted move constructor
body: <p>I have a class with a deleted move constructor and when I try to call std::vector::push_back() in MSVC (v.15.8.7 Visual C++ 2017) I get an error saying that I am trying to access the deleted move constructor. If however I define the move constructor, the code compiles, but the move constructor is never called. Both versions compile and run as expected on gcc (v. 5.4).</p>
  
  <p>Here's a simplified example:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  struct A
  {
  public:
      A() { std::cout &lt;&lt; "ctor-dflt" &lt;&lt; std::endl; }
      A(const A&amp;) { std::cout &lt;&lt; "ctor-copy" &lt;&lt; std::endl; }
      A&amp; operator=(const A&amp;) { std::cout &lt;&lt; "asgn-copy" &lt;&lt; std::endl; return *this; }
      A(A&amp;&amp;) = delete;
      A&amp; operator=(A&amp;&amp; other) = delete;
      ~A() { std::cout &lt;&lt; "dtor" &lt;&lt; std::endl; }
  };
  
  
  int main()
  {
      std::vector&lt;A&gt; v{};
      A a;
      v.push_back(a);
  }
  </code></pre>
  
  <p>which when compiled on Visual Studio gives the following error:</p>
  
  <pre><code>error C2280: 'A::A(A &amp;&amp;)': attempting to reference a deleted function  
  </code></pre>
  
  <p>If however I define the move constructor instead of deleting it</p>
  
  <pre><code> A(A&amp;&amp;) { std::cout &lt;&lt; "ctor-move" &lt;&lt; std::endl; }
  </code></pre>
  
  <p>everything compiles and runs, with following output:</p>
  
  <pre><code>ctor-dflt
  ctor-copy
  dtor
  dtor
  </code></pre>
  
  <p>as expected. No calls to the move constructor. (Live code: <a href="https://rextester.com/XWWA51341" rel="nofollow noreferrer">https://rextester.com/XWWA51341</a>)</p>
  
  <p>Moreover, both versions work perfectly well on gcc. (Live code: <a href="https://rextester.com/FMQERO10656" rel="nofollow noreferrer">https://rextester.com/FMQERO10656</a>)</p>
  
  <p>So my question is, why doesn't a call to std::vector::push_back() on a non-movable object compile in MSVC, even though the move constructor is apparently never called?</p>