diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-06-03 12:30:29 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-06-03 12:30:29 -0400 |
commit | 0614bbbe59c6953e088cffa39dfe63d86fc1fa96 (patch) | |
tree | 3b848e0660f4e2765f2b095d74ce85160426b1e4 /gcc | |
parent | cd4dd47265f2bff89fbbfb6a12a98a7101fb5280 (diff) | |
download | gcc-0614bbbe59c6953e088cffa39dfe63d86fc1fa96.zip gcc-0614bbbe59c6953e088cffa39dfe63d86fc1fa96.tar.gz gcc-0614bbbe59c6953e088cffa39dfe63d86fc1fa96.tar.bz2 |
libstdc++: Avoid hard error in ranges::unique_copy [PR100770]
Here, in the constexpr if condition within ranges::unique_copy, when
input_iterator<_Out> isn't satisfied we must avoid substituting into
iter_value_t<_Out> because the latter isn't necessarily well-formed
then. To that end, this patch factors out the condition into a concept
and uses it throughout.
This patch also makes the definition of our testsuite
output_iterator_wrapper more minimal by setting its value_type, pointer
and reference member types to void. This means our existing tests for
unique_copy already exercise the fix for this bug, so we don't need
to add another test. The only other fallout of this testsuite iterator
change appears in std/ranges/range.cc, where the use of range_value_t
on a test_output_range is now ill-formed.
libstdc++-v3/ChangeLog:
* include/bits/ranges_algo.h (__detail::__can_reread_output):
Factor out this concept from ...
(__unique_copy_fn::operator()): ... here. Use the concept
throughout.
* testsuite/std/ranges/range.cc: Remove now ill-formed use
of range_value_t on an output_range.
* testsuite/util/testsuite_iterators.h (output_iterator_wrapper):
Define value_type, pointer and reference member types to void.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions