https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116217
Bug ID: 116217 Summary: RangeAdaptorClosure pipe operator is underconstrained Product: gcc Version: 14.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: eddiejnolan at gmail dot com Target Milestone: --- libstdc++ accepts the following, which is rejected by libc++ and MSVC: #include <ranges> struct foo : std::ranges::range_adaptor_closure<foo> { auto operator()(auto const&) const { return std::ranges::empty_view<int>{}; } }; inline constexpr foo bar; int main() { auto quux{0 | bar}; } Compiler explorer link: https://godbolt.org/z/ssjqqKbzb The other standard libraries both check that the parameter passed to the range adaptor closure satisifies the range concept, as specified in the wording (https://eel.is/c++draft/range.adaptor.object): A range adaptor closure object is a unary function object that accepts a range argument. For a range adaptor closure object C and an expression R such that decltype((R)) models range, the following expressions are equivalent: C(R) R | C libstdc++ doesn't check that the parameter models range, only checking that the range adaptor closure object is invocable with that parameter.