// Test the example from P2997R1 "Removing the common reference requirement // from the indirectly invocable concepts". // { dg-do compile { target c++20 } } #include #include struct C { auto f() -> void; }; struct Iterator { using value_type = C; using difference_type = std::ptrdiff_t; using iterator_category = std::input_iterator_tag; auto operator*() const -> C&&; auto operator++() -> Iterator&; auto operator++(int) -> void; auto operator==(Iterator const&) const -> bool; }; static_assert(std::input_iterator); static_assert(std::same_as, C>); static_assert(std::same_as, C&&>); struct R { auto begin() -> Iterator; auto end() -> Iterator; }; static_assert(std::ranges::range); static_assert(std::same_as, C&&>); auto f(R r) -> void { std::ranges::for_each(r, [](auto&& c){ c.f(); }); }