https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117284
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #1) > if (__old_data != _Base::data()) > { > this->_M_invalidate_all(); > this->_M_update_guaranteed_capacity(); > } > else if (__old_size < _Base::size()) > this->_M_invalidate_after_nth(_Base::size()); I think we also want: else this->_M_update_guaranteed_capacity(); For the case where new elements are inserted into existing capacity without reallocating.