public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/97512] New: Move std::ranges::subrange structured bindings stuff from <ranges> to <ranges_util.h>
@ 2020-10-21  9:31 hewillk at gmail dot com
  2020-10-21 13:20 ` [Bug libstdc++/97512] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: hewillk at gmail dot com @ 2020-10-21  9:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97512
           Summary: Move std::ranges::subrange structured bindings stuff
                    from <ranges> to <ranges_util.h>
           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: ---

In commit 160061a: libstdc++: Introduce new headers for C++20 ranges
components, structured bindings stuff of std::ranges::subrange is move into
<ranges> header itself, this will make following code failed in gcc-trunk
(https://godbolt.org/z/az5bfc):

#include <vector>
#include <algorithm>

int main() {
  std::vector v{1, 1, 2};
  auto [first, last] = std::ranges::unique(v);
}


error: cannot decompose inaccessible member 'std::ranges::subrange

Put structured bindings stuff together with subrange's definition should be
convenient for users, since std::ranges::remove/unique return a subrange, for a
user like me usually want to structurally bind it without extra including
<ranges>, or it would make sense to have these tuple-related specializations
close to the get functions, which are already in the <bits/ranges_util.h>
header.

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

* [Bug libstdc++/97512] Move std::ranges::subrange structured bindings stuff from <ranges> to <ranges_util.h>
  2020-10-21  9:31 [Bug libstdc++/97512] New: Move std::ranges::subrange structured bindings stuff from <ranges> to <ranges_util.h> hewillk at gmail dot com
@ 2020-10-21 13:20 ` redi at gcc dot gnu.org
  2020-10-21 14:13 ` cvs-commit at gcc dot gnu.org
  2020-10-21 14:13 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2020-10-21 13:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Oops, yes, I should have moved those too.

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

* [Bug libstdc++/97512] Move std::ranges::subrange structured bindings stuff from <ranges> to <ranges_util.h>
  2020-10-21  9:31 [Bug libstdc++/97512] New: Move std::ranges::subrange structured bindings stuff from <ranges> to <ranges_util.h> hewillk at gmail dot com
  2020-10-21 13:20 ` [Bug libstdc++/97512] " redi at gcc dot gnu.org
@ 2020-10-21 14:13 ` cvs-commit at gcc dot gnu.org
  2020-10-21 14:13 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-21 14:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:a186ab670e97c4c3883d96506655c4621e7c5515

commit r11-4188-ga186ab670e97c4c3883d96506655c4621e7c5515
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Oct 21 14:40:54 2020 +0100

    libstdc++: Make structured bindings always work for subranges [PR 97512]

    The definition of ranges::subrange was moved to the new
    <bits/ranges_util.h> header so that it could be used in <algorithm>
    without including the whole of <ranges>. However, the tuple-like support
    that enables subrange to be used with structured bindings was left in
    <ranges>. This is arguably conforming (to use a subrange you should
    include <ranges>) but it's inconvenient and probably confusing.

    This change makes the tuple-like support available whenever subrange
    itself is available.

    libstdc++-v3/ChangeLog:

            PR libstdc++/97512
            * include/bits/ranges_util.h (tuple_size<subrange>)
            (tuple_element<I, cv subrange>): Move here from ...
            * include/std/ranges: ... here.
            * testsuite/std/ranges/subrange/97512.cc: New test.

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

* [Bug libstdc++/97512] Move std::ranges::subrange structured bindings stuff from <ranges> to <ranges_util.h>
  2020-10-21  9:31 [Bug libstdc++/97512] New: Move std::ranges::subrange structured bindings stuff from <ranges> to <ranges_util.h> hewillk at gmail dot com
  2020-10-21 13:20 ` [Bug libstdc++/97512] " redi at gcc dot gnu.org
  2020-10-21 14:13 ` cvs-commit at gcc dot gnu.org
@ 2020-10-21 14:13 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2020-10-21 14:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Done! Thanks for the report.

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

end of thread, other threads:[~2020-10-21 14:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21  9:31 [Bug libstdc++/97512] New: Move std::ranges::subrange structured bindings stuff from <ranges> to <ranges_util.h> hewillk at gmail dot com
2020-10-21 13:20 ` [Bug libstdc++/97512] " redi at gcc dot gnu.org
2020-10-21 14:13 ` cvs-commit at gcc dot gnu.org
2020-10-21 14:13 ` 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).