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

            Bug ID: 100690
           Summary: ranges::iota_view::_Sentinel cannot access _M_current
                    of _Iterator
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

Same access issue as PR100631:

https://godbolt.org/z/z4Ysc1cez

#include <ranges>

int main() {
  int x[] = {42, 42, 42};
  auto r = std::views::iota(std::ranges::begin(x), std::ranges::cbegin(x) + 3);
  r.end() - r.begin();
  r.begin() - r.end();
}

<source>:7:22:   required from here
/opt/compiler-explorer/gcc-trunk-20210519/include/c++/12.0.0/ranges:518:22:
error: 'int* std::ranges::iota_view<int*, const int*>::_Iterator::_M_value' is
private within this context
  518 |         { return __x._M_value - __y._M_bound; }
      |                  ~~~~^~~~~~~~
/opt/compiler-explorer/gcc-trunk-20210519/include/c++/12.0.0/ranges:490:15:
note: declared private here
  490 |         _Winc _M_value = _Winc();
      |               ^~~~~~~~

Reply via email to