]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix various bugs in ranges_algo.h [PR100187, ...]
authorPatrick Palka <ppalka@redhat.com>
Wed, 28 Apr 2021 03:21:19 +0000 (23:21 -0400)
committerPatrick Palka <ppalka@redhat.com>
Wed, 13 Oct 2021 13:32:37 +0000 (09:32 -0400)
commitcb261f0e8fc08fb49f74002582ad5713cda684f7
tree9194ecfa161c7a2d5dc6d8ca1135508cf1261442
parent28f91cc71be921bc12e283b6aa576b8aef0fe335
libstdc++: Fix various bugs in ranges_algo.h [PR100187, ...]

This fixes some bugs with our ranges algorithms in uncommon situations,
such as when the return type of a predicate is a non-copyable class type
that's implicitly convertible to bool (PR100187), when a comparison
predicate isn't invocable as an rvalue (PR100237), and when the return
type of a projection function is non-copyable (PR100249).

This also fixes PR100287, which reports that we're moving __first twice
when constructing with it an empty subrange in ranges::partition.

libstdc++-v3/ChangeLog:

PR libstdc++/100187
PR libstdc++/100237
PR libstdc++/100249
PR libstdc++/100287
* include/bits/ranges_algo.h (__search_n_fn::operator()): Give
the __value_comp lambda an explicit bool return type.
(__is_permutation_fn::operator()): Give the __proj_scan local
variable auto&& return type.  Give the __comp_scan lambda an
explicit bool return type.
(__remove_fn::operator()): Give the __pred lambda an explicit
bool return type.
(__partition_fn::operator()): Don't std::move __first twice
when returning an empty subrange.
(__min_fn::operator()): Don't std::move __comp.
(__max_fn::operator()): Likewise.
(__minmax_fn::operator()): Likewise.

(cherry picked from commit d91e7eab3a2c3957c2220ad71e62d9fc78cccb9b)
libstdc++-v3/include/bits/ranges_algo.h