public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94418] New: Please make reverse_iterator nothrow constructible when possible
@ 2020-03-31 1:15 rafael at espindo dot la
2020-03-31 2:18 ` [Bug c++/94418] " rafael at espindo dot la
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: rafael at espindo dot la @ 2020-03-31 1:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94418
Bug ID: 94418
Summary: Please make reverse_iterator nothrow constructible
when possible
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: rafael at espindo dot la
Target Milestone: ---
The standard in res.on.exception.handling says:
An implementation may strengthen the exception specification for a non-virtual
function by adding a non-throwing exception specification.
So, as far as I understand, libstdc++ could make the constructors of
std::reverse_iterator noexcept when the corresponding constructors of the
underlying iterators are noexcept.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/94418] Please make reverse_iterator nothrow constructible when possible
2020-03-31 1:15 [Bug c++/94418] New: Please make reverse_iterator nothrow constructible when possible rafael at espindo dot la
@ 2020-03-31 2:18 ` rafael at espindo dot la
2020-03-31 7:51 ` [Bug libstdc++/94418] " rguenth at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rafael at espindo dot la @ 2020-03-31 2:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94418
--- Comment #1 from Rafael Avila de Espindola <rafael at espindo dot la> ---
For what it is worth, libc++ implements this. Given
static_assert(std::is_nothrow_copy_constructible_v<std::vector<int>::reverse_iterator>);
With libstdc++:
$ clang -S test3.cc -std=c++17
test3.cc:3:1: error: static_assert failed due to requirement...
with libc++
$ clang clang -S test3.cc -std=c++17 -stdlib=libc++
<no error>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/94418] Please make reverse_iterator nothrow constructible when possible
2020-03-31 1:15 [Bug c++/94418] New: Please make reverse_iterator nothrow constructible when possible rafael at espindo dot la
2020-03-31 2:18 ` [Bug c++/94418] " rafael at espindo dot la
@ 2020-03-31 7:51 ` rguenth at gcc dot gnu.org
2020-03-31 9:06 ` redi at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-31 7:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94418
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Component|c++ |libstdc++
Version|unknown |10.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/94418] Please make reverse_iterator nothrow constructible when possible
2020-03-31 1:15 [Bug c++/94418] New: Please make reverse_iterator nothrow constructible when possible rafael at espindo dot la
2020-03-31 2:18 ` [Bug c++/94418] " rafael at espindo dot la
2020-03-31 7:51 ` [Bug libstdc++/94418] " rguenth at gcc dot gnu.org
@ 2020-03-31 9:06 ` redi at gcc dot gnu.org
2020-03-31 9:19 ` redi at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-03-31 9:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94418
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-03-31
Target Milestone|--- |11.0
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I already prepared a patch doing this last week when finishing the C++20
support for reverse_iterator, but it's not suitable for master this close to
the GCC 10 release. I'll do it for GCC 11.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/94418] Please make reverse_iterator nothrow constructible when possible
2020-03-31 1:15 [Bug c++/94418] New: Please make reverse_iterator nothrow constructible when possible rafael at espindo dot la
` (2 preceding siblings ...)
2020-03-31 9:06 ` redi at gcc dot gnu.org
@ 2020-03-31 9:19 ` redi at gcc dot gnu.org
2021-04-27 11:38 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-03-31 9:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94418
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(Adding the noexcept-specifier *should* be harmless, but it seems every time we
use one of the is_constructible traits something breaks).
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/94418] Please make reverse_iterator nothrow constructible when possible
2020-03-31 1:15 [Bug c++/94418] New: Please make reverse_iterator nothrow constructible when possible rafael at espindo dot la
` (3 preceding siblings ...)
2020-03-31 9:19 ` redi at gcc dot gnu.org
@ 2021-04-27 11:38 ` jakub at gcc dot gnu.org
2021-04-27 11:58 ` redi at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-27 11:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94418
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.0 |11.2
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.1 has been released, retargeting bugs to GCC 11.2.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/94418] Please make reverse_iterator nothrow constructible when possible
2020-03-31 1:15 [Bug c++/94418] New: Please make reverse_iterator nothrow constructible when possible rafael at espindo dot la
` (4 preceding siblings ...)
2021-04-27 11:38 ` jakub at gcc dot gnu.org
@ 2021-04-27 11:58 ` redi at gcc dot gnu.org
2021-04-28 15:53 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-27 11:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94418
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.2 |---
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/94418] Please make reverse_iterator nothrow constructible when possible
2020-03-31 1:15 [Bug c++/94418] New: Please make reverse_iterator nothrow constructible when possible rafael at espindo dot la
` (5 preceding siblings ...)
2021-04-27 11:58 ` redi at gcc dot gnu.org
@ 2021-04-28 15:53 ` redi at gcc dot gnu.org
2021-05-12 9:53 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-28 15:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94418
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Implemented downstream:
https://gitlab.com/jonathan-wakely/gcc
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/94418] Please make reverse_iterator nothrow constructible when possible
2020-03-31 1:15 [Bug c++/94418] New: Please make reverse_iterator nothrow constructible when possible rafael at espindo dot la
` (6 preceding siblings ...)
2021-04-28 15:53 ` redi at gcc dot gnu.org
@ 2021-05-12 9:53 ` redi at gcc dot gnu.org
2021-10-01 19:38 ` cvs-commit at gcc dot gnu.org
2021-10-01 19:52 ` redi at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2021-05-12 9:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94418
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Specifically:
https://gitlab.com/jonathan-wakely/gcc/-/commit/3e63e5a8f72caa3e700788dcbd959f7b738fb9d7
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/94418] Please make reverse_iterator nothrow constructible when possible
2020-03-31 1:15 [Bug c++/94418] New: Please make reverse_iterator nothrow constructible when possible rafael at espindo dot la
` (7 preceding siblings ...)
2021-05-12 9:53 ` redi at gcc dot gnu.org
@ 2021-10-01 19:38 ` cvs-commit at gcc dot gnu.org
2021-10-01 19:52 ` redi at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-01 19:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94418
--- Comment #7 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:d335d73889d897d073b987b4323db05317fccad3
commit r12-4063-gd335d73889d897d073b987b4323db05317fccad3
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Apr 28 11:40:47 2021 +0100
libstdc++: Use conditional noexcept in std::reverse_iterator [PR 94418]
This adds a noexcept-specifier to each constructor and assignment
operator of std::reverse_iterator so that they are noexcept when the
corresponding operation on the underlying iterator is noexcept.
The std::reverse_iterator class template already requires that the
operations on the underlying type are valid, so we don't need to use the
std::is_nothrow_xxx traits to protect against errors when the expression
isn't even valid. We can just use a noexcept operator to test if the
expression can throw, without the overhead of redundantly checking if
the initialization/assignment would be valid.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
PR libstdc++/94418
* include/bits/stl_iterator.h (reverse_iterator): Use
conditional noexcept on constructors and assignment operators.
* testsuite/24_iterators/reverse_iterator/noexcept.cc: New test.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/94418] Please make reverse_iterator nothrow constructible when possible
2020-03-31 1:15 [Bug c++/94418] New: Please make reverse_iterator nothrow constructible when possible rafael at espindo dot la
` (8 preceding siblings ...)
2021-10-01 19:38 ` cvs-commit at gcc dot gnu.org
@ 2021-10-01 19:52 ` redi at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2021-10-01 19:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94418
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |12.0
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Done for GCC 12.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-10-01 19:52 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-31 1:15 [Bug c++/94418] New: Please make reverse_iterator nothrow constructible when possible rafael at espindo dot la
2020-03-31 2:18 ` [Bug c++/94418] " rafael at espindo dot la
2020-03-31 7:51 ` [Bug libstdc++/94418] " rguenth at gcc dot gnu.org
2020-03-31 9:06 ` redi at gcc dot gnu.org
2020-03-31 9:19 ` redi at gcc dot gnu.org
2021-04-27 11:38 ` jakub at gcc dot gnu.org
2021-04-27 11:58 ` redi at gcc dot gnu.org
2021-04-28 15:53 ` redi at gcc dot gnu.org
2021-05-12 9:53 ` redi at gcc dot gnu.org
2021-10-01 19:38 ` cvs-commit at gcc dot gnu.org
2021-10-01 19:52 ` 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).