https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109889

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
When the function returns the iterator's destructor should detach itself from
the sequence's list of iterators, so that it doesn't outlive the stack frame
containing the iterator.

The commit that caused the regression included this change:

        _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
                              _M_message(__msg_bad_inc)
                              ._M_iterator(*this, "this"));
-       _Safe_iterator __ret = *this;
+       _Safe_iterator __ret(*this, _Unchecked());
        ++*this;
        return __ret;
       }

Maybe this affects how/when the __ret object gets destroyed, so it fails to
detach itself.

Reply via email to