[PATCH] PR libstdc++/91620 Implement DR 526 for std::[forward_]list::remove_if/unique
François Dumont
frs.dumont@gmail.com
Mon Aug 10 19:07:10 GMT 2020
Gentle reminder, this time with tests.
I've added one for list::remove cause I think there was none, for
forward_list we had remove_freed.cc.
I added
// { dg-options "-g -O0" }
in the new tests otherwise it doesn't fail, that's life with UB. I know
that it can pass also with those options.
If you prefer we can go without it and let Valgrind detect the issue.
Whatever, once the patch is in place it doesn't fail anymore.
François
On 27/12/19 11:57 am, François Dumont wrote:
> Here is the patch to extend DR 526 to forward_list and list remove_if
> and unique.
>
> As the adopted pattern is simpler I also applied it to the remove
> methods.
>
> PR libstdc++/91620
> * include/bits/forward_list.tcc (forward_list<>::remove): Collect
> nodes
> to destroy in an intermediate forward_list.
> (forward_list<>::remove_if, forward_list<>::unique): Likewise.
> * include/bits/list.tcc (list<>::remove, list<>::unique): Likewise.
> (list<>::remove_if): Likewise.
> * include/debug/forward_list (forward_list<>::_M_erase_after):
> Remove.
> (forward_list<>::erase_after): Adapt.
> (forward_list<>::remove, forward_list<>::remove_if): Collect nodes to
> destroy in an intermediate forward_list.
> (forward_list<>::unique): Likewise.
> * include/debug/list (list<>::remove, list<>::unique): Likewise.
> (list<>::remove_if): Likewise.
>
> Tested under Linux x86_64 normal and debug modes.
>
> Ok to commit ?
>
> François
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 91620.patch
Type: text/x-patch
Size: 21099 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20200810/6dc3742f/attachment-0001.bin>
More information about the Libstdc++
mailing list