mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 12:00:11 -05:00
std::erase and std::erase_if are broken for users directly referencing __gnu_debug::deque in their code that is to say without activating the _GLIBCXX_DEBUG mode. The iterators potentially invalidated by the erase operations are not detected by the __gnu_debug::deque container and so won't be reported as invalidated. We need explicit std::erase and std::erase_if implementations for std::__debug::deque which will work also when _GLIBCXX_DEBUG mode is activated. libstdc++-v3/ChangeLog: * include/debug/deque (std::erase_if<>(std::__debug::deque<>&, _Pred)): New. (std::erase<>(std::__debug::deque<>&, const _Up&)): New. * include/std/deque (std::erase_if(std::deque<>&, _Pred)): Remove _GLIBCXX_DEBUG code. * testsuite/23_containers/deque/debug/erase.cc: New test case. * testsuite/23_containers/deque/debug/invalidation/erase.cc: New test case.