public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/100044] New: ranges::subrange CTAD for __iterator_sentinel_pair not work
@ 2021-04-12 10:41 hewillk at gmail dot com
  2021-04-12 11:44 ` [Bug libstdc++/100044] " hewillk at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hewillk at gmail dot com @ 2021-04-12 10:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100044
           Summary: ranges::subrange CTAD for __iterator_sentinel_pair not
                    work
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

libstdc++ defines the CATD of __iterator_sentinel_pair for the subranges in
ranges_util.h#L355:

355  template<__detail::__iterator_sentinel_pair _Pr>
356    subrange(_Pr)
357      -> subrange<tuple_element_t<0, _Pr>, tuple_element_t<1, _Pr>>;
358
359  template<__detail::__iterator_sentinel_pair _Pr>
360    subrange(_Pr, __detail::__make_unsigned_like_t<iter_difference_t<
361                                                  tuple_element_t<0, _Pr>>>)
362      -> subrange<tuple_element_t<0, _Pr>, tuple_element_t<1, _Pr>,
363               subrange_kind::sized>;

It should be for the convenience to create a subrange directly from the
iterator and sentinel pair:

#include <ranges>
#include <vector>

int main() {
  std::vector v1{1, 2, 3};
  std::pair p{v1.begin(), v1.end()};
  std::ranges::subrange sb{p};
}

But this seems to not work, since subrange(_Rng&& __r) will constraint the _Rng
 at the beginning, which will cause us to be blocked early:

<source>: In function 'int main()':
<source>:7:29: error: no matching function for call to
'std::ranges::subrange<__gnu_cxx::__normal_iterator<int*, std::vector<int,
std::allocator<int> > >, __gnu_cxx::__normal_iterator<int*, std::vector<int,
std::allocator<int> > >,
std::ranges::subrange_kind::sized>::subrange(<brace-enclosed initializer
list>)'
    7 |   std::ranges::subrange sb{p};

Should we consider it a library bug?

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

* [Bug libstdc++/100044] ranges::subrange CTAD for __iterator_sentinel_pair not work
  2021-04-12 10:41 [Bug libstdc++/100044] New: ranges::subrange CTAD for __iterator_sentinel_pair not work hewillk at gmail dot com
@ 2021-04-12 11:44 ` hewillk at gmail dot com
  2021-04-12 11:48 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hewillk at gmail dot com @ 2021-04-12 11:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from 康桓瑋 <hewillk at gmail dot com> ---
The problem seems to be forgetting to delete this CATD in commit
77f5310f0205714538668b88fbf1de44f1f435be.

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

* [Bug libstdc++/100044] ranges::subrange CTAD for __iterator_sentinel_pair not work
  2021-04-12 10:41 [Bug libstdc++/100044] New: ranges::subrange CTAD for __iterator_sentinel_pair not work hewillk at gmail dot com
  2021-04-12 11:44 ` [Bug libstdc++/100044] " hewillk at gmail dot com
@ 2021-04-12 11:48 ` redi at gcc dot gnu.org
  2021-04-12 11:55 ` hewillk at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-12 11:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
   Last reconfirmed|                            |2021-04-12

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It wasn't forgetting it, that commit was implementing https://wg21.link/lwg3282
which didn't remove the deduction guides. The commit was correct.

However, https://wg21.link/lwg3404 subsequently removed the deduction guides,
but we don't implement that one yet, as shown at
https://gcc.gnu.org/wiki/LibstdcxxTodo

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

* [Bug libstdc++/100044] ranges::subrange CTAD for __iterator_sentinel_pair not work
  2021-04-12 10:41 [Bug libstdc++/100044] New: ranges::subrange CTAD for __iterator_sentinel_pair not work hewillk at gmail dot com
  2021-04-12 11:44 ` [Bug libstdc++/100044] " hewillk at gmail dot com
  2021-04-12 11:48 ` redi at gcc dot gnu.org
@ 2021-04-12 11:55 ` hewillk at gmail dot com
  2021-04-12 12:31 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hewillk at gmail dot com @ 2021-04-12 11:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from 康桓瑋 <hewillk at gmail dot com> ---
Never knew the existence of this to-do list, thank you for letting me know.

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

* [Bug libstdc++/100044] ranges::subrange CTAD for __iterator_sentinel_pair not work
  2021-04-12 10:41 [Bug libstdc++/100044] New: ranges::subrange CTAD for __iterator_sentinel_pair not work hewillk at gmail dot com
                   ` (2 preceding siblings ...)
  2021-04-12 11:55 ` hewillk at gmail dot com
@ 2021-04-12 12:31 ` cvs-commit at gcc dot gnu.org
  2021-04-12 14:59 ` cvs-commit at gcc dot gnu.org
  2021-04-12 15:01 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-12 12:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:7569ce583f540ae22c585cc5159e3b23deedd987

commit r11-8132-g7569ce583f540ae22c585cc5159e3b23deedd987
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Apr 12 12:49:17 2021 +0100

    libstdc++: Implement LWG 3404 for C++20 subrange [PR 100044]

    These deduction guides became useless with LWG 3282 (implemented in
    commit r10-6741) and so were removed by LWG 3404.

    libstdc++-v3/ChangeLog:

            PR libstdc++/100044
            * include/bits/ranges_util.h (__detail::__iterator_sentinel_pair):
            Remove helper concept.
            (subrange(_Pr), subrange(Pr, __make_unsigned_like<...>)): Remove
            deduction guides, as per LWG 3404.
            * testsuite/std/ranges/subrange/lwg3282_neg.cc: Check that class
            template argument deduction fails.

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

* [Bug libstdc++/100044] ranges::subrange CTAD for __iterator_sentinel_pair not work
  2021-04-12 10:41 [Bug libstdc++/100044] New: ranges::subrange CTAD for __iterator_sentinel_pair not work hewillk at gmail dot com
                   ` (3 preceding siblings ...)
  2021-04-12 12:31 ` cvs-commit at gcc dot gnu.org
@ 2021-04-12 14:59 ` cvs-commit at gcc dot gnu.org
  2021-04-12 15:01 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-12 14:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

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

commit r10-9699-gb6bef1cbc14080d5dd0a7ddbb81aa4b68ece84a3
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Apr 12 12:49:17 2021 +0100

    libstdc++: Implement LWG 3404 for C++20 subrange [PR 100044]

    These deduction guides became useless with LWG 3282 (implemented in
    commit r10-6741) and so were removed by LWG 3404.

    libstdc++-v3/ChangeLog:

            PR libstdc++/100044
            * include/std/ranges (__detail::__iterator_sentinel_pair):
            Remove helper concept.
            (subrange(_Pr), subrange(Pr, __make_unsigned_like<...>)): Remove
            deduction guides, as per LWG 3404.
            * testsuite/std/ranges/subrange/lwg3282_neg.cc: Check that class
            template argument deduction fails.

    (cherry picked from commit 7569ce583f540ae22c585cc5159e3b23deedd987)

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

* [Bug libstdc++/100044] ranges::subrange CTAD for __iterator_sentinel_pair not work
  2021-04-12 10:41 [Bug libstdc++/100044] New: ranges::subrange CTAD for __iterator_sentinel_pair not work hewillk at gmail dot com
                   ` (4 preceding siblings ...)
  2021-04-12 14:59 ` cvs-commit at gcc dot gnu.org
@ 2021-04-12 15:01 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-12 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The bogus deduction guides are gone now.

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

end of thread, other threads:[~2021-04-12 15:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 10:41 [Bug libstdc++/100044] New: ranges::subrange CTAD for __iterator_sentinel_pair not work hewillk at gmail dot com
2021-04-12 11:44 ` [Bug libstdc++/100044] " hewillk at gmail dot com
2021-04-12 11:48 ` redi at gcc dot gnu.org
2021-04-12 11:55 ` hewillk at gmail dot com
2021-04-12 12:31 ` cvs-commit at gcc dot gnu.org
2021-04-12 14:59 ` cvs-commit at gcc dot gnu.org
2021-04-12 15:01 ` redi 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).