https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100770
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:bee80d74f7ebc8e1ada913aa059dedc0976f28c0 commit r10-9908-gbee80d74f7ebc8e1ada913aa059dedc0976f28c0 Author: Patrick Palka <ppa...@redhat.com> Date: Thu Jun 3 12:30:29 2021 -0400 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. PR libstdc++/100770 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. (cherry picked from commit 0614bbbe59c6953e088cffa39dfe63d86fc1fa96)