From: Tomasz KamiƄski Date: Mon, 19 Jan 2026 09:03:08 +0000 (+0100) Subject: libstdc++: Fix std::erase_if for std::string with -D_GLIBCXX_USE_CXX11_ABI=0. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9a62938be080e1d849f6b1e013633584ecace9b;p=thirdparty%2Fgcc.git libstdc++: Fix std::erase_if for std::string with -D_GLIBCXX_USE_CXX11_ABI=0. The __cow_string used with -D_GLIBCXX_USE_CXX11_ABI=0, does not provide erase accepting const_iterator, so we adjust __detail::__erase.if (introduced in r16-6889-g3287) to call __cont.erase with mutable iterators. libstdc++-v3/ChangeLog: * include/bits/erase_if.h (__detail::__erase_if): Pass mutable iterators to __cont.erase. --- diff --git a/libstdc++-v3/include/bits/erase_if.h b/libstdc++-v3/include/bits/erase_if.h index d5a5278d128..9d14b63a289 100644 --- a/libstdc++-v3/include/bits/erase_if.h +++ b/libstdc++-v3/include/bits/erase_if.h @@ -58,8 +58,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION std::move(__pred)); if (__removed != __end) { - __cont.erase(__niter_wrap(__cont.cbegin(), __removed), - __cont.cend()); + __cont.erase(__niter_wrap(__cont.begin(), __removed), + __cont.end()); return __osz - __ucont.size(); }