https://gcc.gnu.org/g:e9a62938be080e1d849f6b1e013633584ecace9b

commit r16-6895-ge9a62938be080e1d849f6b1e013633584ecace9b
Author: Tomasz KamiƄski <[email protected]>
Date:   Mon Jan 19 10:03:08 2026 +0100

    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:
---
 libstdc++-v3/include/bits/erase_if.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/bits/erase_if.h 
b/libstdc++-v3/include/bits/erase_if.h
index d5a5278d1282..9d14b63a289b 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();
          }

Reply via email to