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

* [Bug libstdc++/100631] ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
  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 ` hewillk at gmail dot com
  2021-05-17  4:50 ` hewillk at gmail dot com
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hewillk at gmail dot com @ 2021-05-17  3:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from 康桓瑋 <hewillk at gmail dot com> ---
Another issue is that in elements_view::_Sentinel in ranges#L3677:


  template<bool _Const2,
           typename _Base2 = __detail::__maybe_const_t<_Const2, _Vp>>
    requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<_Base2>>
    friend constexpr range_difference_t<_Base2>
    operator-(const _Iterator<_Const2>& __x, const _Sentinel& __y)
    { return __x._M_current - __y._M_end; }


the return type of the function is range_difference_t<_Base2>, but in
[range.elements#sentinel], it is defined as range_difference_t<Base>:


  template<bool OtherConst>
    requires sized_­sentinel_­for<sentinel_t<Base>, iterator_t<maybe- 
  const<OtherConst, V>>>
  friend constexpr range_difference_t<Base>
    operator-(const iterator<OtherConst>& x, const sentinel& y);


Perhaps range_difference_t<Base> and range_difference_t<_Base2> are equivalent
in this case, but I am not sure.

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

* [Bug libstdc++/100631] ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
  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
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hewillk at gmail dot com @ 2021-05-17  4:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from 康桓瑋 <hewillk at gmail dot com> ---
In addition, I think elements_view::_Sentinel::_M_equal should be a template
function, and elements_view::_Iterator also needs to declare _Sentinel<!_Const>
as a friend, otherwise the following valid codes will be rejected:

https://godbolt.org/z/7aa75vqsP


#include <ranges>

int main() {
  auto r = std::views::iota(0)
    | std::views::transform([](int) { return std::make_pair(42, "hello"); })
    | std::views::keys;

  auto b = std::ranges::cbegin(r);
  auto e = std::end(r);
  b.base() == e.base();

  b == e; // error
}


<source>:12:9:   required from here
/opt/compiler-explorer/gcc-trunk-20210513/include/c++/12.0.0/ranges:3675:34:
error: cannot convert 'const
std::ranges::elements_view<std::ranges::transform_view<std::ranges::iota_view<int,
std::unreachable_sentinel_t>, main()::<lambda(int)> >, 0>::_Iterator<true>' to
'const
std::ranges::elements_view<std::ranges::transform_view<std::ranges::iota_view<int,
std::unreachable_sentinel_t>, main()::<lambda(int)> >, 0>::_Iterator<false>&'
 3675 |             { return __y._M_equal(__x); }
      |                      ~~~~~~~~~~~~^~~~~
/opt/compiler-explorer/gcc-trunk-20210513/include/c++/12.0.0/ranges:3645:45:
note:   initializing argument 1 of 'constexpr bool
std::ranges::elements_view<_Vp, _Nm>::_Sentinel<_Const>::_M_equal(const
std::ranges::elements_view<_Vp, _Nm>::_Iterator<_Const>&) const [with bool
_Const = false; _Vp = std::ranges::transform_view<std::ranges::iota_view<int,
std::unreachable_sentinel_t>, main()::<lambda(int)> >; long unsigned int _Nm =
0]'
 3645 |           _M_equal(const _Iterator<_Const>& __x) const
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~^~~

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

* [Bug libstdc++/100631] ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
  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
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-05-17 10:29 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
                 CC|                            |ppalka at gcc dot gnu.org
   Last reconfirmed|                            |2021-05-17

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed.

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

* [Bug libstdc++/100631] ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
  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
                   ` (2 preceding siblings ...)
  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
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rs2740 at gmail dot com @ 2021-05-17 12:32 UTC (permalink / raw)
  To: gcc-bugs

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

TC <rs2740 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rs2740 at gmail dot com

--- Comment #4 from TC <rs2740 at gmail dot com> ---
(In reply to 康桓瑋 from comment #1)
> Another issue is that in elements_view::_Sentinel in ranges#L3677:
> 
> 
>   template<bool _Const2,
>            typename _Base2 = __detail::__maybe_const_t<_Const2, _Vp>>
>     requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<_Base2>>
>     friend constexpr range_difference_t<_Base2>
>     operator-(const _Iterator<_Const2>& __x, const _Sentinel& __y)
>     { return __x._M_current - __y._M_end; }
> 
> 
> the return type of the function is range_difference_t<_Base2>, but in
> [range.elements#sentinel], it is defined as range_difference_t<Base>:
> 
> 
>   template<bool OtherConst>
>     requires sized_­sentinel_­for<sentinel_t<Base>, iterator_t<maybe- 
>   const<OtherConst, V>>>
>   friend constexpr range_difference_t<Base>
>     operator-(const iterator<OtherConst>& x, const sentinel& y);
> 
> 
> Perhaps range_difference_t<Base> and range_difference_t<_Base2> are
> equivalent in this case, but I am not sure.

This one is a problem with the WP.

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

* [Bug libstdc++/100631] ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
  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
                   ` (3 preceding siblings ...)
  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
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hewillk at gmail dot com @ 2021-05-17 13:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to TC from comment #4)

> This one is a problem with the WP.

Thanks, Tim, does it have an LWG number?

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

* [Bug libstdc++/100631] ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
  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
                   ` (4 preceding siblings ...)
  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
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-18  4:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:2e2eef80ac0c21f9533e6791ccf5e29458cbb77c

commit r12-854-g2e2eef80ac0c21f9533e6791ccf5e29458cbb77c
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue May 18 00:26:07 2021 -0400

    libstdc++: Fix miscellaneous issues with elements_view::_Sentinel
[PR100631]

    libstdc++-v3/ChangeLog:

            PR libstdc++/100631
            * include/std/ranges (elements_view::_Iterator): Also befriend
            _Sentinel<!_Const>.
            (elements_view::_Sentinel::_M_equal): Templatize.
            (elements_view::_Sentinel::_M_distance_from): Split out from ...
            (elements_view::_Sentinel::operator-): ... here.  Depend on
            _Base2 instead of _Base in the return type.
            * testsuite/std/ranges/adaptors/elements.cc (test06, test07):
            New tests.

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

* [Bug libstdc++/100631] ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
  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
                   ` (5 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: hewillk at gmail dot com @ 2021-05-18  5:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to CVS Commits from comment #6)
> The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
> 
> https://gcc.gnu.org/g:2e2eef80ac0c21f9533e6791ccf5e29458cbb77c
> 
> commit r12-854-g2e2eef80ac0c21f9533e6791ccf5e29458cbb77c
> Author: Patrick Palka <ppalka@redhat.com>
> Date:   Tue May 18 00:26:07 2021 -0400
> 
>     libstdc++: Fix miscellaneous issues with elements_view::_Sentinel
> [PR100631]
>     
>     libstdc++-v3/ChangeLog:
>     
>             PR libstdc++/100631
>             * include/std/ranges (elements_view::_Iterator): Also befriend
>             _Sentinel<!_Const>.
>             (elements_view::_Sentinel::_M_equal): Templatize.
>             (elements_view::_Sentinel::_M_distance_from): Split out from ...
>             (elements_view::_Sentinel::operator-): ... here.  Depend on
>             _Base2 instead of _Base in the return type.
>             * testsuite/std/ranges/adaptors/elements.cc (test06, test07):
>             New tests.



Hey, Patrick, you missed the second one:


    template<bool _Const2,
             typename _Base2 = __detail::__maybe_const_t<_Const2, _Vp>>
    requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<_Base2>>
    friend constexpr range_difference_t<_Base2>
    operator-(const _Iterator<_Const2>& __x, const _Sentinel& __y)
    { return __x._M_current - __y._M_end; }


this should be return -__y._M_distance_from(__x).

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

* [Bug libstdc++/100631] ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
  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
                   ` (6 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-05-18 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to 康桓瑋 from comment #7)
> (In reply to CVS Commits from comment #6)
> > The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
> > 
> > https://gcc.gnu.org/g:2e2eef80ac0c21f9533e6791ccf5e29458cbb77c
> > 
> > commit r12-854-g2e2eef80ac0c21f9533e6791ccf5e29458cbb77c
> > Author: Patrick Palka <ppalka@redhat.com>
> > Date:   Tue May 18 00:26:07 2021 -0400
> > 
> >     libstdc++: Fix miscellaneous issues with elements_view::_Sentinel
> > [PR100631]
> >     
> >     libstdc++-v3/ChangeLog:
> >     
> >             PR libstdc++/100631
> >             * include/std/ranges (elements_view::_Iterator): Also befriend
> >             _Sentinel<!_Const>.
> >             (elements_view::_Sentinel::_M_equal): Templatize.
> >             (elements_view::_Sentinel::_M_distance_from): Split out from ...
> >             (elements_view::_Sentinel::operator-): ... here.  Depend on
> >             _Base2 instead of _Base in the return type.
> >             * testsuite/std/ranges/adaptors/elements.cc (test06, test07):
> >             New tests.
> 
> 
> 
> Hey, Patrick, you missed the second one:
>     
> 
>     template<bool _Const2,
>              typename _Base2 = __detail::__maybe_const_t<_Const2, _Vp>>
>     requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<_Base2>>
>     friend constexpr range_difference_t<_Base2>
>     operator-(const _Iterator<_Const2>& __x, const _Sentinel& __y)
>     { return __x._M_current - __y._M_end; }
> 
> 
> this should be return -__y._M_distance_from(__x).

Indeed, thanks for catching that.  Fix incoming shortly..

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

* [Bug libstdc++/100631] ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
  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
                   ` (7 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-18 14:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:38751c4d5e15bd1c682ac4c868a2c4ce48ca5503

commit r12-880-g38751c4d5e15bd1c682ac4c868a2c4ce48ca5503
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue May 18 10:21:27 2021 -0400

    libstdc++: Fix access issue in elements_view::_Sentinel [PR100631]

    In the earlier commit r12-854 I forgot to also rewrite the other operator-
    overload in terms of the split-out member function _M_distance_from.

    libstdc++-v3/ChangeLog:

            PR libstdc++/100631
            * include/std/ranges (elements_view::_Sentinel::operator-): Use
            _M_distance_from in the other operator- overload too.
            * testsuite/std/ranges/adaptors/elements.cc (test06): Augment test.

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

* [Bug libstdc++/100631] ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
  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
                   ` (8 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-10 18:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:fd4db3ddc3639e03f557010b8e0e947e4b51633e

commit r11-8541-gfd4db3ddc3639e03f557010b8e0e947e4b51633e
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue May 18 00:26:07 2021 -0400

    libstdc++: Fix miscellaneous issues with elements_view::_Sentinel
[PR100631]

    libstdc++-v3/ChangeLog:

            PR libstdc++/100631
            * include/std/ranges (elements_view::_Iterator): Also befriend
            _Sentinel<!_Const>.
            (elements_view::_Sentinel::_M_equal): Templatize.
            (elements_view::_Sentinel::_M_distance_from): Split out from ...
            (elements_view::_Sentinel::operator-): ... here.  Depend on
            _Base2 instead of _Base in the return type.
            * testsuite/std/ranges/adaptors/elements.cc (test06, test07):
            New tests.

    (cherry picked from commit 2e2eef80ac0c21f9533e6791ccf5e29458cbb77c)

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

* [Bug libstdc++/100631] ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
  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
                   ` (9 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-10 18:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:3b93d61be5a5a93e95783b80c58b297e215badf1

commit r11-8542-g3b93d61be5a5a93e95783b80c58b297e215badf1
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue May 18 10:21:27 2021 -0400

    libstdc++: Fix access issue in elements_view::_Sentinel [PR100631]

    In the earlier commit r12-854 I forgot to also rewrite the other operator-
    overload in terms of the split-out member function _M_distance_from.

    libstdc++-v3/ChangeLog:

            PR libstdc++/100631
            * include/std/ranges (elements_view::_Sentinel::operator-): Use
            _M_distance_from in the other operator- overload too.
            * testsuite/std/ranges/adaptors/elements.cc (test06): Augment test.

    (cherry picked from commit 38751c4d5e15bd1c682ac4c868a2c4ce48ca5503)

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

* [Bug libstdc++/100631] ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
  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
                   ` (10 preceding siblings ...)
  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
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-10 18:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:648c786bc6451115604c60abcc7977b3c6987ae4

commit r10-9903-g648c786bc6451115604c60abcc7977b3c6987ae4
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue May 18 00:26:07 2021 -0400

    libstdc++: Fix miscellaneous issues with elements_view::_Sentinel
[PR100631]

    libstdc++-v3/ChangeLog:

            PR libstdc++/100631
            * include/std/ranges (elements_view::_Iterator): Also befriend
            _Sentinel<!_Const>.
            (elements_view::_Sentinel::_M_equal): Templatize.
            (elements_view::_Sentinel::_M_distance_from): Split out from ...
            (elements_view::_Sentinel::operator-): ... here.  Depend on
            _Base2 instead of _Base in the return type.
            * testsuite/std/ranges/adaptors/elements.cc (test06, test07):
            New tests.

    (cherry picked from commit 2e2eef80ac0c21f9533e6791ccf5e29458cbb77c)

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

* [Bug libstdc++/100631] ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
  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
                   ` (11 preceding siblings ...)
  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
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-10 18:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:b1f54b2b7d876c72ab05afb0df214aba205f94ad

commit r10-9904-gb1f54b2b7d876c72ab05afb0df214aba205f94ad
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue May 18 10:21:27 2021 -0400

    libstdc++: Fix access issue in elements_view::_Sentinel [PR100631]

    In the earlier commit r12-854 I forgot to also rewrite the other operator-
    overload in terms of the split-out member function _M_distance_from.

    libstdc++-v3/ChangeLog:

            PR libstdc++/100631
            * include/std/ranges (elements_view::_Sentinel::operator-): Use
            _M_distance_from in the other operator- overload too.
            * testsuite/std/ranges/adaptors/elements.cc (test06): Augment test.

    (cherry picked from commit 38751c4d5e15bd1c682ac4c868a2c4ce48ca5503)

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

* [Bug libstdc++/100631] ranges::elements_view:: _Sentinel is missing __distance_from() that can access _M_current of _Iterator
  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
                   ` (12 preceding siblings ...)
  2021-06-10 18:58 ` cvs-commit at gcc dot gnu.org
@ 2021-06-10 18:58 ` ppalka at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-06-10 18:58 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |10.4
             Status|ASSIGNED                    |RESOLVED

--- Comment #14 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for 10.4/11.2/12

^ 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).