]> gcc.gnu.org Git - 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:48:17 +0000 (09:48 -0400)
commit139bafaaba0c775ca65712621bd60e079b488d73
tree6be085c9ee55ca376ff08881f67bc0e9a1174e17
parenta0865d33b293bd0a949562dd6e73f097a767a40e
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
This page took 0.06617 seconds and 6 git commands to generate.