title: Using an object without copy and without a noexcept move constructor in a vector. What actually breaks and how can I confirm it?
body: <p>I've checked a lot of move constructor/vector/noexcept threads, but I am still unsure what actually happens when things are supposed to go wrong. I can't produce an error when I expect to, so either my little test is wrong, or my understanding of the problem is wrong.</p>
  
  <p>I am using a vector of a BufferTrio object, which defines a noexcept(false) move constructor, and deletes every other constructor/assignment operator so that there's nothing to fall back to:</p>
  
  <pre><code>    BufferTrio(const BufferTrio&amp;) = delete;
      BufferTrio&amp; operator=(const BufferTrio&amp;) = delete;
      BufferTrio&amp; operator=(BufferTrio&amp;&amp; other) = delete;
  
      BufferTrio(BufferTrio&amp;&amp; other) noexcept(false)
          : vaoID(other.vaoID)
          , vboID(other.vboID)
          , eboID(other.eboID)
      {
          other.vaoID = 0;
          other.vboID = 0;
          other.eboID = 0;
      }
  </code></pre>
  
  <p>Things compile and run, but from <em><a href="https://xinhuang.github.io/posts/2013-12-31-when-to-use-noexcept-and-when-to-not.html" rel="noreferrer">https://xinhuang.github.io/posts/2013-12-31-when-to-use-noexcept-and-when-to-not.html</a>:</em></p>
  
  <blockquote>
    <p>std::vector will use move when it needs to increase(or decrease) the capacity, as long as the move operation is noexcept.</p>
  </blockquote>
  
  <p>Or from <em>Optimized C++: Proven Techniques for Heightened Performance By Kurt Guntheroth</em>:</p>
  
  <blockquote>
    <p>If the move constructor and move assignment operator are not declared noexcept, std::vector uses the less efficient copy operations instead.</p>
  </blockquote>
  
  <p>Since I've deleted those, my understanding is that something should be breaking here. But things are running ok with that vector. So I also created a basic loop that push_backs half a million times into a dummy vector, and then swapped that vector with another single-element dummy vector. Like so:</p>
  
  <pre><code>    vector&lt;BufferTrio&gt; thing;
  
      int n = 500000;
      while (n--)
      {
          thing.push_back(BufferTrio());
      }
  
      vector&lt;BufferTrio&gt; thing2;
      thing2.push_back(BufferTrio());
  
      thing.swap(thing2);
      cout &lt;&lt; "Sizes are " &lt;&lt; thing.size() &lt;&lt; " and " &lt;&lt; thing2.size() &lt;&lt; endl;
      cout &lt;&lt; "Capacities are " &lt;&lt; thing.capacity() &lt;&lt; " and " &lt;&lt; thing2.capacity() &lt;&lt; endl;
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>Sizes are 1 and 500000
  Capacities are 1 and 699913
  </code></pre>
  
  <p>Still no problems, so:</p>
  
  <p><strong>Should I see something going wrong, and if so, how can I demonstrate it?</strong></p>