https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124425
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think this should do it:
struct sentinel { };
struct iterator
{
using value_type = int;
using difference_type = int;
struct proxy
{
int i;
constexpr operator int() const { return i; }
};
constexpr iterator& operator++() { ++i; return *this; }
constexpr iterator operator++(int) { return iterator{i++}; }
constexpr proxy operator*() const { return proxy{i}; }
constexpr bool operator==(sentinel) const { return i == 10; }
int i = 0;
};
struct range
{
constexpr iterator begin() const { return {}; };
constexpr sentinel end() const { return {}; };
};
#include <ranges>
static_assert(std::ranges::input_range<::range>);
#include <meta>
constexpr auto sp = std::meta::reflect_constant_array(range{});