public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/100631] New: ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
@ 2021-05-17  3:22 hewillk at gmail dot com
  2021-05-17  3:45 ` [Bug libstdc++/100631] " hewillk at gmail dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: hewillk at gmail dot com @ 2021-05-17  3:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100631
           Summary: ranges::elements_view:: _Sentinel is missing
                    __distance_from() that can 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: ---

We should add a __distance_from() to elements_view::_Sentinel just like
transform_view:: _Sentinel does.


https://godbolt.org/z/Ezxh78bv5

#include <ranges>

int main() {
  auto r = std::views::iota(0)
    | std::views::filter([](int){ return true; })
    | std::views::take(42)
    | std::views::reverse
    | std::views::transform([](int) { return std::make_pair(42, "hello"); })
    | std::views::take(42)
    | std::views::keys;
  auto b = r.begin();
  auto e = r.end();
  e - b;
}


<source>:13:8:   required from here
/opt/compiler-explorer/gcc-trunk-20210513/include/c++/12.0.0/ranges:3689:39:
error:
'std::ranges::iterator_t<std::ranges::take_view<std::ranges::transform_view<std::ranges::reverse_view<std::ranges::take_view<std::ranges::filter_view<std::ranges::iota_view<int,
std::unreachable_sentinel_t>, main()::<lambda(int)> > > >,
main()::<lambda(int)> > > >
std::ranges::elements_view<std::ranges::take_view<std::ranges::transform_view<std::ranges::reverse_view<std::ranges::take_view<std::ranges::filter_view<std::ranges::iota_view<int,
std::unreachable_sentinel_t>, main()::<lambda(int)> > > >,
main()::<lambda(int)> > >, 0>::_Iterator<false>::_M_current' is private within
this context
 3689 |             { return __x._M_end - __y._M_current; }
      |                                   ~~~~^~~~~~~~~~
/opt/compiler-explorer/gcc-trunk-20210513/include/c++/12.0.0/ranges:3465:29:
note: declared private here
 3465 |           iterator_t<_Base> _M_current = iterator_t<_Base>();
      |                             ^~~~~~~~~~

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-06-10 18:58 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17  3:22 [Bug libstdc++/100631] New: ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator hewillk at gmail dot com
2021-05-17  3:45 ` [Bug libstdc++/100631] " hewillk at gmail dot com
2021-05-17  4:50 ` hewillk at gmail dot com
2021-05-17 10:29 ` ppalka at gcc dot gnu.org
2021-05-17 12:32 ` rs2740 at gmail dot com
2021-05-17 13:34 ` hewillk at gmail dot com
2021-05-18  4:35 ` cvs-commit at gcc dot gnu.org
2021-05-18  5:32 ` hewillk at gmail dot com
2021-05-18 13:50 ` ppalka at gcc dot gnu.org
2021-05-18 14:22 ` cvs-commit at gcc dot gnu.org
2021-06-10 18:54 ` cvs-commit at gcc dot gnu.org
2021-06-10 18:54 ` cvs-commit at gcc dot gnu.org
2021-06-10 18:57 ` cvs-commit at gcc dot gnu.org
2021-06-10 18:58 ` cvs-commit at gcc dot gnu.org
2021-06-10 18:58 ` ppalka at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).