https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110542
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- The GCC error is fixed by this change: --- a/libstdc++-v3/include/bits/vector.tcc +++ b/libstdc++-v3/include/bits/vector.tcc @@ -701,6 +701,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER pointer __old_start = this->_M_impl._M_start; pointer __old_finish = this->_M_impl._M_finish; + _Tp val; + if (__old_start != __old_finish) + val = std::move(*__old_start); + const size_type __len = _M_check_len(__n, "vector::_M_default_append"); pointer __new_start(this->_M_allocate(__len)); Which makes no sense whatsoever, as it's just a redundant read from *__old_start, which cannot change whether or not that pointer has already been deallocated when read from again later! So I think this part is a GCC bug.