public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/106798] New: adjacent_view::_Iterator(_Iterator<!_Const>) requires random_access_iterator
@ 2022-09-01  5:57 hewillk at gmail dot com
  2022-09-01 10:07 ` [Bug libstdc++/106798] " hewillk at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hewillk at gmail dot com @ 2022-09-01  5:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106798
           Summary: adjacent_view::_Iterator(_Iterator<!_Const>) requires
                    random_access_iterator
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

ranges#L5216:

    constexpr
    _Iterator(_Iterator<!_Const> __i)
      requires _Const && convertible_to<iterator_t<_Vp>, iterator_t<_Base>>
    {
      for (size_t __j = 0; __j < _Nm; ++__j)
        _M_current[__j] = std::move(__i[__j]);
    }

__i[__j] requires random_access_iterator, which is unnecessary.
ranges::move(__i._M_current, _M_current.begin()) should be enough (which
requires an extra include header).
The testcase would be


    #include <ranges>
    int main() {
      const auto r = std::views::single(0)
                   | std::views::lazy_split(0)
                   | std::views::pairwise;
      decltype(r.end()) e = auto(r).end();
    }

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

* [Bug libstdc++/106798] adjacent_view::_Iterator(_Iterator<!_Const>) requires random_access_iterator
  2022-09-01  5:57 [Bug libstdc++/106798] New: adjacent_view::_Iterator(_Iterator<!_Const>) requires random_access_iterator hewillk at gmail dot com
@ 2022-09-01 10:07 ` hewillk at gmail dot com
  2022-09-01 14:04 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: hewillk at gmail dot com @ 2022-09-01 10:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to 康桓瑋 from comment #0)
> __i[__j] requires random_access_iterator, which is unnecessary.

In fact it's just a typo, it should be _M_current[__j] =
std::move(__i._M_current[__j]);

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

* [Bug libstdc++/106798] adjacent_view::_Iterator(_Iterator<!_Const>) requires random_access_iterator
  2022-09-01  5:57 [Bug libstdc++/106798] New: adjacent_view::_Iterator(_Iterator<!_Const>) requires random_access_iterator hewillk at gmail dot com
  2022-09-01 10:07 ` [Bug libstdc++/106798] " hewillk at gmail dot com
@ 2022-09-01 14:04 ` ppalka at gcc dot gnu.org
  2022-09-09 19:05 ` cvs-commit at gcc dot gnu.org
  2022-09-09 19:06 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-09-01 14:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-09-01
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Nice catch, thanks for the report.

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

* [Bug libstdc++/106798] adjacent_view::_Iterator(_Iterator<!_Const>) requires random_access_iterator
  2022-09-01  5:57 [Bug libstdc++/106798] New: adjacent_view::_Iterator(_Iterator<!_Const>) requires random_access_iterator hewillk at gmail dot com
  2022-09-01 10:07 ` [Bug libstdc++/106798] " hewillk at gmail dot com
  2022-09-01 14:04 ` ppalka at gcc dot gnu.org
@ 2022-09-09 19:05 ` cvs-commit at gcc dot gnu.org
  2022-09-09 19:06 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-09 19:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:e469506b7fdd1bf2c958ca3140573a474fcba3b8

commit r13-2568-ge469506b7fdd1bf2c958ca3140573a474fcba3b8
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Sep 9 14:56:37 2022 -0400

    libstdc++: Fix typo in adjacent_view::_Iterator [PR106798]

            PR libstdc++/106798

    libstdc++-v3/ChangeLog:

            * include/std/ranges (adjacent_view::_Iterator::_Iterator): Fix
            typo.
            * testsuite/std/ranges/adaptors/adjacent/1.cc (test04): New test.

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

* [Bug libstdc++/106798] adjacent_view::_Iterator(_Iterator<!_Const>) requires random_access_iterator
  2022-09-01  5:57 [Bug libstdc++/106798] New: adjacent_view::_Iterator(_Iterator<!_Const>) requires random_access_iterator hewillk at gmail dot com
                   ` (2 preceding siblings ...)
  2022-09-09 19:05 ` cvs-commit at gcc dot gnu.org
@ 2022-09-09 19:06 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-09-09 19:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |13.0

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-09-09 19:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-01  5:57 [Bug libstdc++/106798] New: adjacent_view::_Iterator(_Iterator<!_Const>) requires random_access_iterator hewillk at gmail dot com
2022-09-01 10:07 ` [Bug libstdc++/106798] " hewillk at gmail dot com
2022-09-01 14:04 ` ppalka at gcc dot gnu.org
2022-09-09 19:05 ` cvs-commit at gcc dot gnu.org
2022-09-09 19:06 ` 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).