title: Mixing operator new[] and placement new with ordinary delete[]
body: <p>Just out of curiosity, is the following legal?</p>
  
  <pre><code>X* p = static_cast&lt;X*&gt;(operator new[](3 * sizeof(X)));
  new(p + 0) X();
  new(p + 1) X();
  new(p + 2) X();
  
  delete[] p;   // Am I allowed to use delete[] here? Or is it undefined behavior?
  </code></pre>
  
  <p>Similarly:</p>
  
  <pre><code>X* q = new X[3]();
  
  (q + 2)-&gt;~X();
  (q + 1)-&gt;~X();
  (q + 0)-&gt;~X();
  operator delete[](q);
  </code></pre>