https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111549
Bug ID: 111549 Summary: _RangeAdaptorClosure's (adaptor | adaptor) operator is underconstrained Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: hewillk at gmail dot com Target Milestone: --- // Compose the adaptors __lhs and __rhs into a pipeline, returning // another range adaptor closure object. template<typename _Lhs, typename _Rhs> requires __is_range_adaptor_closure<_Lhs> && __is_range_adaptor_closure<_Rhs> constexpr auto operator|(_Lhs __lhs, _Rhs __rhs) { return _Pipe<_Lhs, _Rhs>{std::move(__lhs), std::move(__rhs)}; } User-defined range adapter closure is not necessarily movable, in which case we may need to constrain the pipe operator to avoid hard errors inside the function. #include <ranges> struct Closure : std::ranges::range_adaptor_closure<Closure> { Closure() = default; Closure(Closure&&) = delete; auto operator()(std::ranges::range auto&&) const; }; int main() { auto r = std::views::take(5) | Closure{}; } https://godbolt.org/z/eqdvxxh3r