https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93267

            Bug ID: 93267
           Summary: std::ranges::begin|end do not work for iota_view when
                    the element and bound type are the same
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pilarlatiesa at gmail dot com
  Target Milestone: ---

The following testcase emits errors at the specified locations:

#include <cstddef>
#include <ranges>

int main()
{
std::size_t const Zero = 0u;
std::size_t const Size = 10u;

auto const Test1 = std::ranges::views::iota(0, Size);
auto beginTest1 = std::ranges::begin(Test1); // OK

auto const Test2 = std::ranges::views::iota(Zero, Size);
auto beginTest2 = std::ranges::begin(Test2); // Error

std::ranges::iota_view const Test3(Zero, Size);
auto beginTest3 = std::ranges::begin(Test3); // Error

std::ranges::iota_view<std::size_t, std::size_t> const Test4(0, Size);
auto beginTest4 = std::ranges::begin(Test4); // Error

std::ranges::iota_view<int, std::size_t> const Test5(0, Size);
auto beginTest4 = std::ranges::begin(Test5); // OK
}

The error reads:

error: no match for call to '(const std::ranges::__cust_access::_Begin) (const
std::ranges::iota_view<long unsigned int, long unsigned int>&)'


/home/pililatiesa/gcc-trunk-20200114/include/c++/10.0.0/bits/range_access.h:420:2:
note: candidate: 'constexpr auto
std::ranges::__cust_access::_Begin::operator()(_Tp&&) const [with _Tp = const
std::ranges::iota_view<long unsigned int, long unsigned int>&]'

  420 |  operator()(_Tp&& __t) const noexcept(_S_noexcept<_Tp>())

      |  ^~~~~~~~

/home/pililatiesa/gcc-trunk-20200114/include/c++/10.0.0/bits/range_access.h:420:2:
note: constraints not satisfied

<source>: In instantiation of 'constexpr auto
std::ranges::__cust_access::_Begin::operator()(_Tp&&) const [with _Tp = const
std::ranges::iota_view<long unsigned int, long unsigned int>&]':

<source>:10:34:   required from here

/home/pililatiesa/gcc-trunk-20200114/include/c++/10.0.0/bits/range_access.h:420:2:
  required by the constraints of 'template<class _Tp>  requires
(__maybe_safe_range<_Tp>) && ((is_array_v<typename
std::remove_reference<_Tp>::remove_reference_t>) || (__member_begin<_Tp>) ||
(__adl_begin<_Tp>)) constexpr auto
std::ranges::__cust_access::_Begin::operator()(_Tp&&) const'

/home/pililatiesa/gcc-trunk-20200114/include/c++/10.0.0/bits/range_access.h:418:4:
note: neither operand of the disjunction is satisfied

  418 |    || __adl_begin<_Tp>

Reply via email to