public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/95983] New: `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator`
@ 2020-06-29 18:19 ensadc at mailnesia dot com
  2020-07-08 14:56 ` [Bug libstdc++/95983] " redi at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: ensadc at mailnesia dot com @ 2020-06-29 18:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95983
           Summary: `std::counted_iterator<std::iterator_t<std::ranges::ba
                    sic_istream_view<...>>>` fails to satisfy
                    `std::input_or_output_iterator`
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ensadc at mailnesia dot com
  Target Milestone: ---

https://wandbox.org/permlink/rUZlUGG4UFeWicbM
====
#include <ranges>
#include <iterator>
#include <iostream>
using R =
  std::ranges::basic_istream_view<int, char, std::char_traits<char>>;
using It = std::ranges::iterator_t<R>;
static_assert(std::input_or_output_iterator<std::counted_iterator<It>>);

====
prog.cc:5:20: error: static assertion failed
    5 | static_assert(std::input_or_output_iterator<std::counted_iterator<T>>);
      |               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cc:5:20: note: constraints not satisfied
In file included from
/opt/wandbox/gcc-head/include/c++/11.0.0/bits/stl_iterator_base_types.h:71,
                 from /opt/wandbox/gcc-head/include/c++/11.0.0/iterator:61,
                 from /opt/wandbox/gcc-head/include/c++/11.0.0/ranges:44,
                 from prog.cc:1:
/opt/wandbox/gcc-head/include/c++/11.0.0/bits/iterator_concepts.h:536:13:  
required for the satisfaction of 'weakly_incrementable<_Iter>' [with _Iter =
std::counted_iterator<std::ranges::basic_istream_view<int, char,
std::char_traits<char> >::_Iterator<int, char, std::char_traits<char> > >]
/opt/wandbox/gcc-head/include/c++/11.0.0/bits/iterator_concepts.h:538:10:   in
requirements with '_Iter __i' [with _Tp =
std::counted_iterator<std::ranges::basic_istream_view<int, char,
std::char_traits<char> >::_Iterator<int, char, std::char_traits<char> > >;
_Iter = std::counted_iterator<std::ranges::basic_istream_view<int, char,
std::char_traits<char> >::_Iterator<int, char, std::char_traits<char> > >]
/opt/wandbox/gcc-head/include/c++/11.0.0/bits/iterator_concepts.h:540:11: note:
the required type 'std::iter_difference_t<_Iter>' is invalid
  540 |  typename iter_difference_t<_Iter>;
      |  ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/opt/wandbox/gcc-head/include/c++/11.0.0/bits/iterator_concepts.h:541:21: note:
nested requirement '__is_signed_integer_like<typename
std::__detail::__iter_traits_impl<typename std::remove_cv<typename
std::remove_reference<_Tp>::type>::type, std::incrementable_traits<typename
std::remove_cv<typename std::remove_reference<_Tp>::type>::type>
>::type::difference_type>' is not satisfied
  541 |  requires __detail::__is_signed_integer_like<iter_difference_t<_Iter>>;
      |           ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: note: set '-fconcepts-diagnostics-depth=' to at least 2 for more
detail

====
It seems that in this case, `iter_difference_t` is treated as an alias of
`std::iterator_traits<std::counted_iterator<It>>::difference_type` (which
doesn't exist), because libstdc++ defines a specialization of
`std::iterator_traits<std::counted_iterator<It>>`.

(The error message is worse than it should be, due to bug 94862 and bug 95303.)

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

* [Bug libstdc++/95983] `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator`
  2020-06-29 18:19 [Bug libstdc++/95983] New: `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator` ensadc at mailnesia dot com
@ 2020-07-08 14:56 ` redi at gcc dot gnu.org
  2020-07-27  5:07 ` ensadc at mailnesia dot com
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-08 14:56 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-07-08
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to ensadc from comment #0)
> It seems that in this case, `iter_difference_t` is treated as an alias of
> `std::iterator_traits<std::counted_iterator<It>>::difference_type` (which
> doesn't exist), because libstdc++ defines a specialization of
> `std::iterator_traits<std::counted_iterator<It>>`.

That specialization is required, see [counted.iterator], and we define it
correctly.

This seems to be a defect in C++20. iter_difference_t<I> is required to use
iterator_traits<I>::difference_type if iterator_traits<I> is specialized, which
it is here. But the specialization doesn't define difference_type.

It doesn't matter that incrementable_traits<I>::difference_type is defined,
because it doesn't get used.

I think the fix is (untested):

--- a/libstdc++-v3/include/bits/stl_iterator.h
+++ b/libstdc++-v3/include/bits/stl_iterator.h
@@ -2141,16 +2141,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       iter_difference_t<_It> _M_length = 0;
     };

-  template<typename _It>
-    struct incrementable_traits<counted_iterator<_It>>
-    {
-      using difference_type = iter_difference_t<_It>;
-    };
-
   template<input_iterator _It>
     struct iterator_traits<counted_iterator<_It>> : iterator_traits<_It>
     {
       using pointer = void;
+      using difference_type = iter_difference_t<_It>;
     };
 #endif // C++20

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

* [Bug libstdc++/95983] `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator`
  2020-06-29 18:19 [Bug libstdc++/95983] New: `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator` ensadc at mailnesia dot com
  2020-07-08 14:56 ` [Bug libstdc++/95983] " redi at gcc dot gnu.org
@ 2020-07-27  5:07 ` ensadc at mailnesia dot com
  2021-04-19 10:40 ` redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ensadc at mailnesia dot com @ 2020-07-27  5:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from ensadc at mailnesia dot com ---
See also LWG 3408 (https://wg21.link/lwg3408), which also suggests that the
`iterator_traits<counted_iterator<It>>` specialization is problematic.

I think the standard could remove this specialization (and define
`iterator_concept` in `counted_iterator`), since this specialization seems to
have only negative effect.

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

* [Bug libstdc++/95983] `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator`
  2020-06-29 18:19 [Bug libstdc++/95983] New: `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator` ensadc at mailnesia dot com
  2020-07-08 14:56 ` [Bug libstdc++/95983] " redi at gcc dot gnu.org
  2020-07-27  5:07 ` ensadc at mailnesia dot com
@ 2021-04-19 10:40 ` redi at gcc dot gnu.org
  2021-04-20  3:52 ` ppalka at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-19 10:40 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|redi at gcc dot gnu.org            |unassigned at gcc dot gnu.org
             Status|ASSIGNED                    |NEW

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

* [Bug libstdc++/95983] `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator`
  2020-06-29 18:19 [Bug libstdc++/95983] New: `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator` ensadc at mailnesia dot com
                   ` (2 preceding siblings ...)
  2021-04-19 10:40 ` redi at gcc dot gnu.org
@ 2021-04-20  3:52 ` ppalka at gcc dot gnu.org
  2021-04-20  7:45 ` gcc-bugs at marehr dot dialup.fu-berlin.de
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-20  3:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
P2259R1 (wg21.link/p2259r1) fixes this issue and similar ones.

Patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-April/568272.html

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

* [Bug libstdc++/95983] `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator`
  2020-06-29 18:19 [Bug libstdc++/95983] New: `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator` ensadc at mailnesia dot com
                   ` (3 preceding siblings ...)
  2021-04-20  3:52 ` ppalka at gcc dot gnu.org
@ 2021-04-20  7:45 ` gcc-bugs at marehr dot dialup.fu-berlin.de
  2021-04-20 13:19 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: gcc-bugs at marehr dot dialup.fu-berlin.de @ 2021-04-20  7:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from gcc-bugs at marehr dot dialup.fu-berlin.de ---
Hi Patrick,

thank you for that patch. I guess that it also fixes
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96070.

Will this patch be backported to gcc-10?

Great work!

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

* [Bug libstdc++/95983] `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator`
  2020-06-29 18:19 [Bug libstdc++/95983] New: `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator` ensadc at mailnesia dot com
                   ` (4 preceding siblings ...)
  2021-04-20  7:45 ` gcc-bugs at marehr dot dialup.fu-berlin.de
@ 2021-04-20 13:19 ` cvs-commit at gcc dot gnu.org
  2021-04-20 13:20 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-20 13:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:902b40c797a86f76791c32d537ba06dff5f1ba27

commit r12-8-g902b40c797a86f76791c32d537ba06dff5f1ba27
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Apr 20 09:18:50 2021 -0400

    libstdc++: Implement P2259R1 changes [PR95983]

    This implements the wording changes of P2259R1 "Repairing input range
    adaptors and counted_iterator", which resolves LWG 3283, 3289 and 3408.

    The wording changes are relatively straightforward, but they require
    some boilerplate to implement: the changes to make a type alias
    "conditionally present" in some iterator class are realized by defining
    a base class template and an appropriately constrained partial
    specialization thereof that contains the type alias, and having the
    iterator class derive from this base class.  Sometimes the relevant
    condition depend on members from the iterator class, but because a
    class is incomplete when instantiating its bases, the constraints on
    the partial specialization can't use anything from the iterator class.
    This patch works around this by hoisting these members out to the
    enclosing scope (e.g. transform_view::_Iterator::_Base is hoisted out
    to transform_view::_Base so that transform_view::__iter_cat can use it).

    This patch also implements the proposed resolution of LWG 3291 to rename
    iota_view::iterator_category to iota_view::iterator_concept, which was
    previously problematic due to LWG 3408.

    libstdc++-v3/ChangeLog:

            PR libstdc++/95983
            * include/bits/stl_iterator.h (__detail::__move_iter_cat):
            Define.
            (move_iterator): Derive from the above in C++20 in order to
            conditionally define iterator_category as per P2259.
            (move_iterator::__base_cat): No longer used, so remove.
            (move_iterator::iterator_category): Remove in C++20.
            (__detail::__common_iter_use_postfix_proxy): Define.
            (common_iterator::_Proxy): Rename to ...
            (common_iterator:__arrow_proxy): ... this.
            (common_iterator::__postfix_proxy): Define as per P2259.
            (common_iterator::operator->): Adjust.
            (common_iterator::operator++): Adjust as per P2259.
            (iterator_traits<common_iterator>::_S_iter_cat): Define.
            (iterator_traits<common_iterator>::iterator_category): Change as
            per P2259.
            (__detail::__counted_iter_value_type): Define.
            (__detail::__counted_iter_concept): Define.
            (__detail::__counted_iter_cat): Define.
            (counted_iterator): Derive from the above three classes in order
            to conditionally define value_type, iterator_concept and
            iterator category respectively as per P2259.
            (counted_iterator::operator->): Define as per P2259.
            (incrementable_traits<counted_iterator>): Remove as per P2259.
            (iterator_traits<counted_iterator>): Adjust as per P2259.
            * include/std/ranges (__detail::__iota_view_iter_cat): Define.
            (iota_view::_Iterator): Derive from the above in order to
            conditionally define iterator_category as per P2259.
            (iota_view::_S_iter_cat): Rename to ...
            (iota_view::_S_iter_concept): ... this.
            (iota_view::iterator_concept): Use it to apply LWG 3291 changes.
            (iota_view::iterator_category): Remove.
            (__detail::__filter_view_iter_cat): Define.
            (filter_view::_Iterator): Derive from the above in order to
            conditionally define iterator_category as per P2259.
            (filter_view::_Iterator): Move to struct __filter_view_iter_cat.
            (filter_view::_Iterator::iterator_category): Remove.
            (transform_view::_Base): Define.
            (transform_view::__iter_cat): Define.
            (transform_view::_Iterator): Derive from the above in order to
            conditionally define iterator_category as per P2259.
            (transform_view::_Iterator::_Base): Just alias
            transform_view::_Base.
            (transform_view::_Iterator::_S_iter_cat): Move to struct
            transform_view::__iter_cat.
            (transform_view::_Iterator::iterator_category): Remove.
            (transform_view::_Sentinel::_Base): Just alias
            transform_view::_Base.
            (join_view::_Base): Define.
            (join_view::_Outer_iter): Define.
            (join_view::_Inner_iter): Define.
            (join_view::_S_ref_is_glvalue): Define.
            (join_view::__iter_cat): Define.
            (join_view::_Iterator): Derive from it in order to conditionally
            define iterator_category as per P2259.
            (join_view::_Iterator::_Base): Just alias join_view::_Base.
            (join_view::_Iterator::_S_ref_is_glvalue): Just alias
            join_view::_S_ref_is_glvalue.
            (join_view::_Iterator::_S_iter_cat): Move to struct
            transform_view::__iter_cat.
            (join_view::_Iterator::_Outer_iter): Just alias
            join_view::_Outer_iter.
            (join_view::_Iterator::_Inner_iter): Just alias
            join_view::_Inner_iter.
            (join_view::_Iterator::iterator_category): Remove.
            (join_view::_Sentinel::_Base): Just alias join_view::_Base.
            (__detail::__split_view_outer_iter_cat): Define.
            (__detail::__split_view_inner_iter_cat): Define.
            (split_view::_Base): Define.
            (split_view::_Outer_iter): Derive from __split_view_outer_iter_cat
            in order to conditionally define iterator_category as per P2259.
            (split_view::_Outer_iter::iterator_category): Remove.
            (split_view::_Inner_iter): Derive from __split_view_inner_iter_cat
            in order to conditionally define iterator_category as per P2259.
            (split_view::_Inner_iter::_S_iter_cat): Move to
            __split_view_inner_iter_cat.
            (split_view::_Inner_iter::iterator_category): Remove.
            (elements_view::_Base): Define.
            (elements_view::__iter_cat): Define.
            (elements_view::_Iterator): Derive from the above in order to
            conditionall define iterator_category as per P2259.
            (elements_view::_Iterator::_Base): Just alias
            elements_view::_Base.
            (elements_view::_Iterator::_S_iter_concept)
            (elements_view::_Iterator::iterator_concept): Define as per
            P2259.
            (elements_view::_Iterator::iterator_category): Remove.
            (elements_view::_Sentinel::_Base): Just alias
            elements_view::_Base.
            * testsuite/24_iterators/headers/iterator/synopsis_c++20.cc:
            Adjust constraints on iterator_traits<counted_iterator>.
            * testsuite/std/ranges/p2259.cc: New test.

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

* [Bug libstdc++/95983] `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator`
  2020-06-29 18:19 [Bug libstdc++/95983] New: `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator` ensadc at mailnesia dot com
                   ` (5 preceding siblings ...)
  2021-04-20 13:19 ` cvs-commit at gcc dot gnu.org
@ 2021-04-20 13:20 ` cvs-commit at gcc dot gnu.org
  2021-04-20 15:39 ` ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-20 13:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:eecefcb78c311b509d9fac2fe38b5b293e095bec

commit r11-8262-geecefcb78c311b509d9fac2fe38b5b293e095bec
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Apr 20 09:18:50 2021 -0400

    libstdc++: Implement P2259R1 changes [PR95983]

    This implements the wording changes of P2259R1 "Repairing input range
    adaptors and counted_iterator", which resolves LWG 3283, 3289 and 3408.

    The wording changes are relatively straightforward, but they require
    some boilerplate to implement: the changes to make a type alias
    "conditionally present" in some iterator class are realized by defining
    a base class template and an appropriately constrained partial
    specialization thereof that contains the type alias, and having the
    iterator class derive from this base class.  Sometimes the relevant
    condition depend on members from the iterator class, but because a
    class is incomplete when instantiating its bases, the constraints on
    the partial specialization can't use anything from the iterator class.
    This patch works around this by hoisting these members out to the
    enclosing scope (e.g. transform_view::_Iterator::_Base is hoisted out
    to transform_view::_Base so that transform_view::__iter_cat can use it).

    This patch also implements the proposed resolution of LWG 3291 to rename
    iota_view::iterator_category to iota_view::iterator_concept, which was
    previously problematic due to LWG 3408.

    libstdc++-v3/ChangeLog:

            PR libstdc++/95983
            * include/bits/stl_iterator.h (__detail::__move_iter_cat):
            Define.
            (move_iterator): Derive from the above in C++20 in order to
            conditionally define iterator_category as per P2259.
            (move_iterator::__base_cat): No longer used, so remove.
            (move_iterator::iterator_category): Remove in C++20.
            (__detail::__common_iter_use_postfix_proxy): Define.
            (common_iterator::_Proxy): Rename to ...
            (common_iterator:__arrow_proxy): ... this.
            (common_iterator::__postfix_proxy): Define as per P2259.
            (common_iterator::operator->): Adjust.
            (common_iterator::operator++): Adjust as per P2259.
            (iterator_traits<common_iterator>::_S_iter_cat): Define.
            (iterator_traits<common_iterator>::iterator_category): Change as
            per P2259.
            (__detail::__counted_iter_value_type): Define.
            (__detail::__counted_iter_concept): Define.
            (__detail::__counted_iter_cat): Define.
            (counted_iterator): Derive from the above three classes in order
            to conditionally define value_type, iterator_concept and
            iterator category respectively as per P2259.
            (counted_iterator::operator->): Define as per P2259.
            (incrementable_traits<counted_iterator>): Remove as per P2259.
            (iterator_traits<counted_iterator>): Adjust as per P2259.
            * include/std/ranges (__detail::__iota_view_iter_cat): Define.
            (iota_view::_Iterator): Derive from the above in order to
            conditionally define iterator_category as per P2259.
            (iota_view::_S_iter_cat): Rename to ...
            (iota_view::_S_iter_concept): ... this.
            (iota_view::iterator_concept): Use it to apply LWG 3291 changes.
            (iota_view::iterator_category): Remove.
            (__detail::__filter_view_iter_cat): Define.
            (filter_view::_Iterator): Derive from the above in order to
            conditionally define iterator_category as per P2259.
            (filter_view::_Iterator): Move to struct __filter_view_iter_cat.
            (filter_view::_Iterator::iterator_category): Remove.
            (transform_view::_Base): Define.
            (transform_view::__iter_cat): Define.
            (transform_view::_Iterator): Derive from the above in order to
            conditionally define iterator_category as per P2259.
            (transform_view::_Iterator::_Base): Just alias
            transform_view::_Base.
            (transform_view::_Iterator::_S_iter_cat): Move to struct
            transform_view::__iter_cat.
            (transform_view::_Iterator::iterator_category): Remove.
            (transform_view::_Sentinel::_Base): Just alias
            transform_view::_Base.
            (join_view::_Base): Define.
            (join_view::_Outer_iter): Define.
            (join_view::_Inner_iter): Define.
            (join_view::_S_ref_is_glvalue): Define.
            (join_view::__iter_cat): Define.
            (join_view::_Iterator): Derive from it in order to conditionally
            define iterator_category as per P2259.
            (join_view::_Iterator::_Base): Just alias join_view::_Base.
            (join_view::_Iterator::_S_ref_is_glvalue): Just alias
            join_view::_S_ref_is_glvalue.
            (join_view::_Iterator::_S_iter_cat): Move to struct
            transform_view::__iter_cat.
            (join_view::_Iterator::_Outer_iter): Just alias
            join_view::_Outer_iter.
            (join_view::_Iterator::_Inner_iter): Just alias
            join_view::_Inner_iter.
            (join_view::_Iterator::iterator_category): Remove.
            (join_view::_Sentinel::_Base): Just alias join_view::_Base.
            (__detail::__split_view_outer_iter_cat): Define.
            (__detail::__split_view_inner_iter_cat): Define.
            (split_view::_Base): Define.
            (split_view::_Outer_iter): Derive from __split_view_outer_iter_cat
            in order to conditionally define iterator_category as per P2259.
            (split_view::_Outer_iter::iterator_category): Remove.
            (split_view::_Inner_iter): Derive from __split_view_inner_iter_cat
            in order to conditionally define iterator_category as per P2259.
            (split_view::_Inner_iter::_S_iter_cat): Move to
            __split_view_inner_iter_cat.
            (split_view::_Inner_iter::iterator_category): Remove.
            (elements_view::_Base): Define.
            (elements_view::__iter_cat): Define.
            (elements_view::_Iterator): Derive from the above in order to
            conditionall define iterator_category as per P2259.
            (elements_view::_Iterator::_Base): Just alias
            elements_view::_Base.
            (elements_view::_Iterator::_S_iter_concept)
            (elements_view::_Iterator::iterator_concept): Define as per
            P2259.
            (elements_view::_Iterator::iterator_category): Remove.
            (elements_view::_Sentinel::_Base): Just alias
            elements_view::_Base.
            * testsuite/24_iterators/headers/iterator/synopsis_c++20.cc:
            Adjust constraints on iterator_traits<counted_iterator>.
            * testsuite/std/ranges/p2259.cc: New test.

    (cherry picked from commit 902b40c797a86f76791c32d537ba06dff5f1ba27)

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

* [Bug libstdc++/95983] `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator`
  2020-06-29 18:19 [Bug libstdc++/95983] New: `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator` ensadc at mailnesia dot com
                   ` (6 preceding siblings ...)
  2021-04-20 13:20 ` cvs-commit at gcc dot gnu.org
@ 2021-04-20 15:39 ` ppalka at gcc dot gnu.org
  2021-04-20 15:59 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-20 15:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 96070 has been marked as a duplicate of this bug. ***

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

* [Bug libstdc++/95983] `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator`
  2020-06-29 18:19 [Bug libstdc++/95983] New: `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator` ensadc at mailnesia dot com
                   ` (7 preceding siblings ...)
  2021-04-20 15:39 ` ppalka at gcc dot gnu.org
@ 2021-04-20 15:59 ` ppalka at gcc dot gnu.org
  2021-05-04 13:51 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-20 15:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to gcc-bugs from comment #4)
> Hi Patrick,
> 
> thank you for that patch. I guess that it also fixes
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96070.

Ah indeed, thanks.  The testcase there seems similar enough to mark the PR as a
dup of this one.

> 
> Will this patch be backported to gcc-10?

I believe so; fortunately, the patch applies pretty cleanly to the 10 branch,
so I don't expect many changes will be needed in order to backport.

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

* [Bug libstdc++/95983] `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator`
  2020-06-29 18:19 [Bug libstdc++/95983] New: `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator` ensadc at mailnesia dot com
                   ` (8 preceding siblings ...)
  2021-04-20 15:59 ` ppalka at gcc dot gnu.org
@ 2021-05-04 13:51 ` cvs-commit at gcc dot gnu.org
  2021-05-04 13:52 ` ppalka at gcc dot gnu.org
  2021-05-04 20:21 ` gcc-bugs at marehr dot dialup.fu-berlin.de
  11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-04 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 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:1cb39945993c89746b0347746bd1267de85cbc42

commit r10-9796-g1cb39945993c89746b0347746bd1267de85cbc42
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Apr 20 09:18:50 2021 -0400

    libstdc++: Implement P2259R1 changes [PR95983]

    This implements the wording changes of P2259R1 "Repairing input range
    adaptors and counted_iterator", which resolves LWG 3283, 3289 and 3408.

    The wording changes are relatively straightforward, but they require
    some boilerplate to implement: the changes to make a type alias
    "conditionally present" in some iterator class are realized by defining
    a base class template and an appropriately constrained partial
    specialization thereof that contains the type alias, and having the
    iterator class derive from this base class.  Sometimes the relevant
    condition depend on members from the iterator class, but because a
    class is incomplete when instantiating its bases, the constraints on
    the partial specialization can't use anything from the iterator class.
    This patch works around this by hoisting these members out to the
    enclosing scope (e.g. transform_view::_Iterator::_Base is hoisted out
    to transform_view::_Base so that transform_view::__iter_cat can use it).

    This patch also implements the proposed resolution of LWG 3291 to rename
    iota_view::iterator_category to iota_view::iterator_concept, which was
    previously problematic due to LWG 3408.

    libstdc++-v3/ChangeLog:

            PR libstdc++/95983
            * include/bits/stl_iterator.h (__detail::__move_iter_cat):
            Define.
            (move_iterator): Derive from the above in C++20 in order to
            conditionally define iterator_category as per P2259.
            (move_iterator::__base_cat): No longer used, so remove.
            (move_iterator::iterator_category): Remove in C++20.
            (__detail::__common_iter_use_postfix_proxy): Define.
            (common_iterator::_Proxy): Rename to ...
            (common_iterator:__arrow_proxy): ... this.
            (common_iterator::__postfix_proxy): Define as per P2259.
            (common_iterator::operator->): Adjust.
            (common_iterator::operator++): Adjust as per P2259.
            (iterator_traits<common_iterator>::_S_iter_cat): Define.
            (iterator_traits<common_iterator>::iterator_category): Change as
            per P2259.
            (__detail::__counted_iter_value_type): Define.
            (__detail::__counted_iter_concept): Define.
            (__detail::__counted_iter_cat): Define.
            (counted_iterator): Derive from the above three classes in order
            to conditionally define value_type, iterator_concept and
            iterator category respectively as per P2259.
            (counted_iterator::operator->): Define as per P2259.
            (incrementable_traits<counted_iterator>): Remove as per P2259.
            (iterator_traits<counted_iterator>): Adjust as per P2259.
            * include/std/ranges (__detail::__iota_view_iter_cat): Define.
            (iota_view::_Iterator): Derive from the above in order to
            conditionally define iterator_category as per P2259.
            (iota_view::_S_iter_cat): Rename to ...
            (iota_view::_S_iter_concept): ... this.
            (iota_view::iterator_concept): Use it to apply LWG 3291 changes.
            (iota_view::iterator_category): Remove.
            (__detail::__filter_view_iter_cat): Define.
            (filter_view::_Iterator): Derive from the above in order to
            conditionally define iterator_category as per P2259.
            (filter_view::_Iterator): Move to struct __filter_view_iter_cat.
            (filter_view::_Iterator::iterator_category): Remove.
            (transform_view::_Base): Define.
            (transform_view::__iter_cat): Define.
            (transform_view::_Iterator): Derive from the above in order to
            conditionally define iterator_category as per P2259.
            (transform_view::_Iterator::_Base): Just alias
            transform_view::_Base.
            (transform_view::_Iterator::_S_iter_cat): Move to struct
            transform_view::__iter_cat.
            (transform_view::_Iterator::iterator_category): Remove.
            (transform_view::_Sentinel::_Base): Just alias
            transform_view::_Base.
            (join_view::_Base): Define.
            (join_view::_Outer_iter): Define.
            (join_view::_Inner_iter): Define.
            (join_view::_S_ref_is_glvalue): Define.
            (join_view::__iter_cat): Define.
            (join_view::_Iterator): Derive from it in order to conditionally
            define iterator_category as per P2259.
            (join_view::_Iterator::_Base): Just alias join_view::_Base.
            (join_view::_Iterator::_S_ref_is_glvalue): Just alias
            join_view::_S_ref_is_glvalue.
            (join_view::_Iterator::_S_iter_cat): Move to struct
            transform_view::__iter_cat.
            (join_view::_Iterator::_Outer_iter): Just alias
            join_view::_Outer_iter.
            (join_view::_Iterator::_Inner_iter): Just alias
            join_view::_Inner_iter.
            (join_view::_Iterator::iterator_category): Remove.
            (join_view::_Sentinel::_Base): Just alias join_view::_Base.
            (__detail::__split_view_outer_iter_cat): Define.
            (__detail::__split_view_inner_iter_cat): Define.
            (split_view::_Base): Define.
            (split_view::_Outer_iter): Derive from __split_view_outer_iter_cat
            in order to conditionally define iterator_category as per P2259.
            (split_view::_Outer_iter::iterator_category): Remove.
            (split_view::_Inner_iter): Derive from __split_view_inner_iter_cat
            in order to conditionally define iterator_category as per P2259.
            (split_view::_Inner_iter::_S_iter_cat): Move to
            __split_view_inner_iter_cat.
            (split_view::_Inner_iter::iterator_category): Remove.
            (elements_view::_Base): Define.
            (elements_view::__iter_cat): Define.
            (elements_view::_Iterator): Derive from the above in order to
            conditionall define iterator_category as per P2259.
            (elements_view::_Iterator::_Base): Just alias
            elements_view::_Base.
            (elements_view::_Iterator::_S_iter_concept)
            (elements_view::_Iterator::iterator_concept): Define as per
            P2259.
            (elements_view::_Iterator::iterator_category): Remove.
            (elements_view::_Sentinel::_Base): Just alias
            elements_view::_Base.
            * testsuite/24_iterators/headers/iterator/synopsis_c++20.cc:
            Adjust constraints on iterator_traits<counted_iterator>.
            * testsuite/std/ranges/p2259.cc: New test.

    (cherry picked from commit 902b40c797a86f76791c32d537ba06dff5f1ba27)

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

* [Bug libstdc++/95983] `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator`
  2020-06-29 18:19 [Bug libstdc++/95983] New: `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator` ensadc at mailnesia dot com
                   ` (9 preceding siblings ...)
  2021-05-04 13:51 ` cvs-commit at gcc dot gnu.org
@ 2021-05-04 13:52 ` ppalka at gcc dot gnu.org
  2021-05-04 20:21 ` gcc-bugs at marehr dot dialup.fu-berlin.de
  11 siblings, 0 replies; 13+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-05-04 13:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

* [Bug libstdc++/95983] `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator`
  2020-06-29 18:19 [Bug libstdc++/95983] New: `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator` ensadc at mailnesia dot com
                   ` (10 preceding siblings ...)
  2021-05-04 13:52 ` ppalka at gcc dot gnu.org
@ 2021-05-04 20:21 ` gcc-bugs at marehr dot dialup.fu-berlin.de
  11 siblings, 0 replies; 13+ messages in thread
From: gcc-bugs at marehr dot dialup.fu-berlin.de @ 2021-05-04 20:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from gcc-bugs at marehr dot dialup.fu-berlin.de ---
Thank you so much!

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

end of thread, other threads:[~2021-05-04 20:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-29 18:19 [Bug libstdc++/95983] New: `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator` ensadc at mailnesia dot com
2020-07-08 14:56 ` [Bug libstdc++/95983] " redi at gcc dot gnu.org
2020-07-27  5:07 ` ensadc at mailnesia dot com
2021-04-19 10:40 ` redi at gcc dot gnu.org
2021-04-20  3:52 ` ppalka at gcc dot gnu.org
2021-04-20  7:45 ` gcc-bugs at marehr dot dialup.fu-berlin.de
2021-04-20 13:19 ` cvs-commit at gcc dot gnu.org
2021-04-20 13:20 ` cvs-commit at gcc dot gnu.org
2021-04-20 15:39 ` ppalka at gcc dot gnu.org
2021-04-20 15:59 ` ppalka at gcc dot gnu.org
2021-05-04 13:51 ` cvs-commit at gcc dot gnu.org
2021-05-04 13:52 ` ppalka at gcc dot gnu.org
2021-05-04 20:21 ` gcc-bugs at marehr dot dialup.fu-berlin.de

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