https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101599

--- Comment #2 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to 康桓瑋 from comment #0)
>
> 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.
>

And ranges::reverse_copy also forgets std::move for the
std::weakly_incrementable _Out.

#include <algorithm>

struct I {
  using value_type = int;
  using difference_type = std::ptrdiff_t;

  I() = default;
  I(I&&) = default;
  I(const I&) = delete;
  I& operator=(I&&) = default;

  I& operator++();
  I operator++(int);
  value_type& operator*() const;
  bool operator==(const I&) const;
};

int main() {
  std::ranges::reverse_copy(std::array<int, 5>{}, I{});
}

https://godbolt.org/z/9Mfb1h3ad

Reply via email to