public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/100833] New: ranges::advance should return n when i == bound
@ 2021-05-30 13:51 hewillk at gmail dot com
2021-06-01 15:04 ` [Bug libstdc++/100833] " redi at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: hewillk at gmail dot com @ 2021-05-30 13:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100833
Bug ID: 100833
Summary: ranges::advance should return n when i == bound
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: ---
This is specified in [range.iter.op.advance#7]:
"Returns: n - M, where M is the difference between the ending and starting
positions of i."
#include <ranges>
constexpr auto diff = [] {
auto r = std::views::single(0) |
std::views::filter([](int) { return true; });
auto it = r.begin();
return std::ranges::advance(it, 100, r.begin());
}();
static_assert(diff == 100);
https://godbolt.org/z/6nh8xMWYd
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/100833] ranges::advance should return n when i == bound
2021-05-30 13:51 [Bug libstdc++/100833] New: ranges::advance should return n when i == bound hewillk at gmail dot com
@ 2021-06-01 15:04 ` redi at gcc dot gnu.org
2021-06-01 16:09 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-01 15:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100833
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |10.4
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2021-06-01
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/100833] ranges::advance should return n when i == bound
2021-05-30 13:51 [Bug libstdc++/100833] New: ranges::advance should return n when i == bound hewillk at gmail dot com
2021-06-01 15:04 ` [Bug libstdc++/100833] " redi at gcc dot gnu.org
@ 2021-06-01 16:09 ` cvs-commit at gcc dot gnu.org
2021-06-02 13:43 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-01 16:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100833
--- Comment #1 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:d8326291695c0f13124c232ddf4fd34e3310e649
commit r12-1146-gd8326291695c0f13124c232ddf4fd34e3310e649
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Jun 1 16:02:45 2021 +0100
libstdc++: Fix return value of std::ranges::advance [PR 100833]
The three-argument form of ranges::advance is supposed to return the
difference between the second argument and the distance the iterator was
advanced. When a non-random-access iterator is not advanced (because it
already equals the sentinel) we were returning 0 rather than n - 0.
libstdc++-v3/ChangeLog:
PR libstdc++/100833
* include/bits/ranges_base.h (ranges::advance(iter, n, sentinel)):
Fix return value for no-op case.
* testsuite/24_iterators/range_operations/advance.cc: Test
return values of three-argument overload.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/100833] ranges::advance should return n when i == bound
2021-05-30 13:51 [Bug libstdc++/100833] New: ranges::advance should return n when i == bound hewillk at gmail dot com
2021-06-01 15:04 ` [Bug libstdc++/100833] " redi at gcc dot gnu.org
2021-06-01 16:09 ` cvs-commit at gcc dot gnu.org
@ 2021-06-02 13:43 ` cvs-commit at gcc dot gnu.org
2021-06-03 14:58 ` cvs-commit at gcc dot gnu.org
2021-06-03 14:58 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-02 13:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100833
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:88ed4abb351117f3b7ef9174b3f538c73e6012c7
commit r11-8502-g88ed4abb351117f3b7ef9174b3f538c73e6012c7
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Jun 1 16:02:45 2021 +0100
libstdc++: Fix return value of std::ranges::advance [PR 100833]
The three-argument form of ranges::advance is supposed to return the
difference between the second argument and the distance the iterator was
advanced. When a non-random-access iterator is not advanced (because it
already equals the sentinel) we were returning 0 rather than n - 0.
libstdc++-v3/ChangeLog:
PR libstdc++/100833
* include/bits/ranges_base.h (ranges::advance(iter, n, sentinel)):
Fix return value for no-op case.
* testsuite/24_iterators/range_operations/advance.cc: Test
return values of three-argument overload.
(cherry picked from commit d8326291695c0f13124c232ddf4fd34e3310e649)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/100833] ranges::advance should return n when i == bound
2021-05-30 13:51 [Bug libstdc++/100833] New: ranges::advance should return n when i == bound hewillk at gmail dot com
` (2 preceding siblings ...)
2021-06-02 13:43 ` cvs-commit at gcc dot gnu.org
@ 2021-06-03 14:58 ` cvs-commit at gcc dot gnu.org
2021-06-03 14:58 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-03 14:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100833
--- Comment #3 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:753c8680a46d371e179ff1ade36002486361095e
commit r10-9887-g753c8680a46d371e179ff1ade36002486361095e
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Jun 1 16:02:45 2021 +0100
libstdc++: Fix return value of std::ranges::advance [PR 100833]
The three-argument form of ranges::advance is supposed to return the
difference between the second argument and the distance the iterator was
advanced. When a non-random-access iterator is not advanced (because it
already equals the sentinel) we were returning 0 rather than n - 0.
libstdc++-v3/ChangeLog:
PR libstdc++/100833
* include/bits/range_access.h (ranges::advance(iter, n, sentinel)):
Fix return value for no-op case.
* testsuite/24_iterators/range_operations/advance.cc: Test
return values of three-argument overload.
(cherry picked from commit d8326291695c0f13124c232ddf4fd34e3310e649)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/100833] ranges::advance should return n when i == bound
2021-05-30 13:51 [Bug libstdc++/100833] New: ranges::advance should return n when i == bound hewillk at gmail dot com
` (3 preceding siblings ...)
2021-06-03 14:58 ` cvs-commit at gcc dot gnu.org
@ 2021-06-03 14:58 ` redi at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-03 14:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100833
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 10.4 and 11.2
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-06-03 14:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-30 13:51 [Bug libstdc++/100833] New: ranges::advance should return n when i == bound hewillk at gmail dot com
2021-06-01 15:04 ` [Bug libstdc++/100833] " redi at gcc dot gnu.org
2021-06-01 16:09 ` cvs-commit at gcc dot gnu.org
2021-06-02 13:43 ` cvs-commit at gcc dot gnu.org
2021-06-03 14:58 ` cvs-commit at gcc dot gnu.org
2021-06-03 14:58 ` 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).