]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix std::erase_if for std::string with -D_GLIBCXX_USE_CXX11_ABI=0.
authorTomasz Kamiński <tkaminsk@redhat.com>
Mon, 19 Jan 2026 09:03:08 +0000 (10:03 +0100)
committerTomasz Kamiński <tkaminsk@redhat.com>
Mon, 19 Jan 2026 09:17:47 +0000 (10:17 +0100)
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.

libstdc++-v3/include/bits/erase_if.h

index d5a5278d1282ed1bbf02107ef6d9426dbecd20b7..9d14b63a289bad69d07fcc3a296b990c1dbef69f 100644 (file)
@@ -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();
          }