diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2020-05-27 22:08:15 +0100 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-17 13:09:10 -0300 |
commit | 9e2940721bf99fb52d01f9459cf32ddd0ca17e47 (patch) | |
tree | 483c081f80a160c73b48663c526f3327f966c9c1 /gcc/builtin-types.def | |
parent | 7d1b26b5e76fe921f77c89ac1e7da130d7fe4ebb (diff) | |
download | gcc-9e2940721bf99fb52d01f9459cf32ddd0ca17e47.tar.gz |
libstdc++: Fix view adaptors for mixed-const sentinels and iterators (PR 95322)
The bug report is that transform_view's sentinel<false> cannot be
compared to its iterator<true>. The comparison is supposed to use
operator==(iterator<Const>, sentinel<Const>) after converting
sentinel<false> to sentinel<true>. However, the operator== is a hidden
friend so is not a candidate when comparing iterator<true> with
sentinel<false>. The required conversion would only happen if we'd found
the operator, but we can't find the operator until after the conversion
happens.
A new LWG issue has been reported, but not yet assigned a number. The
solution suggested by Casey Carter is to make the hidden friends of the
sentinel types work with iterators of any const-ness, so that no
conversions are required.
Patrick Palka observed that join_view has a similar problem and a
similar fix is used for its sentinel.
PR libstdc++/95322
* include/std/ranges (transform_view::_Sentinel): Allow hidden
friends to work with _Iterator<true> and _Iterator<false>.
(join_view::_Sentinel): Likewise.
* testsuite/std/ranges/adaptors/95322.cc: New test.
Diffstat (limited to 'gcc/builtin-types.def')
0 files changed, 0 insertions, 0 deletions