https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121917
Bug ID: 121917 Summary: ranges::shuffle incorrectly requires its arguments to model sized_sentinel_for Product: gcc Version: 15.2.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- #include <algorithm> #include <iterator> #include <random> struct non_default_sentinel_t { }; template<std::input_or_output_iterator I> bool operator==(const I& i, non_default_sentinel_t) { return i == std::default_sentinel; } int main() { int a[2]{}; std::counted_iterator iter(a, 2); std::default_random_engine e; std::ranges::shuffle(iter(a, 2), non_default_sentinel_t{}, e); } This fails to compile: 1972 | const __uc_type __urange = __uc_type(__last - __first);