[PATCH][_GLIBCXX_DEBUG] Fix std::erase_if implementation for std::vector

François Dumont frs.dumont@gmail.com
Mon Nov 24 17:11:05 GMT 2025


On 11/20/25 22:51, Jonathan Wakely wrote:
>
>
> On Thu, 20 Nov 2025, 20:36 François Dumont, <frs.dumont@gmail.com> wrote:
>
>
>     On 11/19/25 14:51, Jonathan Wakely wrote:
>     > On Tue, 18 Nov 2025 at 21:38, François
>     Dumont<frs.dumont@gmail.com> wrote:
>     >> Ok, here is the new patch, only fixing thestd::erase_if
>     behavior for
>     >> the _GLIBCXX_DEBUG.
>     > Is that right? I thought this change is to benefit direct uses of
>     > __gnu_debug::vector notstd::vector with _GLIBCXX_DEBUG? The
>     first new
>     > test already passes when usingstd::vector with -D_GLIBCXX_DEBUG. In
>     > fact, it FAILs with this patch! So this change is not helping
>     > _GLIBCXX_DEBUG, it's making it worse.
>     >
>     > I see the problem there, you need to check __glibcxx_erase_if in
>     > <debug/vector>, not __cpp_lib_erase_if. The latter hasn't been
>     defined
>     > yet because <debug/vector> gets included before
>     > __glibcxx_want_erase_if is defined in <vector>. You probably
>     won't see
>     > the FAILs for a default configuration of GCC, but if you configure
>     > with --disable-libstdcxx-pch then it will fail.
>
>     Caught again by pch, I wonder if those should not be disabled per
>     default when running tests.
>
>     I did this for the 2 new tests.
>
>
> We don't want the no_pch option in these tests, they're not special, 
> and they're not testing macros which really do depend on pch.
>
> These tests (and 99% of the tests in the testsuite) should work 
> correctly with pch or without pch.
>
Ok, I'll stick to that plan in the future.

Thanks for taking care.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20251124/ce4a74ba/attachment.htm>


More information about the Libstdc++ mailing list