https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101599
Bug ID: 101599 Summary: ranges::__copy_or_move missing std::move for input_iterator Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: hewillk at gmail dot com Target Milestone: --- ranges_algobase.h#L247: else if constexpr (__is_normal_iterator<_Out>) { auto [__in,__out] = ranges::__copy_or_move<_IsMove>(__first, __last, __result.base()); return {std::move(__in), decltype(__result){__out}}; } We should std::move __first to recursive ranges::__copy_or_move() call since some input_iterator such as basic_istream_view::iterator does not have the copy constructor. #include <algorithm> #include <ranges> #include <sstream> int main() { auto ints = std::istringstream{"42"}; auto r = std::ranges::istream_view<int>(ints); std::vector v(1, 0); std::ranges::copy(r, v.begin()); } https://godbolt.org/z/hh1o36df8