New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[span.cons] thinks that to_address() can throw, but it can't #3534
Comments
[span.cons]/9 fails to account for the fact that EDIT: And by "we", I probably mean "me". |
As discussed at cplusplus/draft#3534 two std::span constructors specify incorrect conditions for throwing exceptions. This patch makes those constructors have correct noexcept-specifiers that accurately reflect what can actually throw. (span(ContiguousIterator, Sentinel)): Add conditional noexcept. * include/std/span (span(ContiguousIterator, size_type)): Change noexcept to be unconditionally true. * testsuite/23_containers/span/nothrow_cons.cc: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@279206 138bc75d-0d04-0410-961f-82ee72b054a4
This is now LWG 3358. |
Looks like we can editorially replace the phrases about to_address with "Throws: Nothing.", but of course the "last-first" issue needs to be addressed non-editorially. |
As discussed at cplusplus/draft#3534 two std::span constructors specify incorrect conditions for throwing exceptions. This patch makes those constructors have correct noexcept-specifiers that accurately reflect what can actually throw. (span(ContiguousIterator, Sentinel)): Add conditional noexcept. * include/std/span (span(ContiguousIterator, size_type)): Change noexcept to be unconditionally true. * testsuite/23_containers/span/nothrow_cons.cc: New test. From-SVN: r279206
The changes applied here fix the editorial issue that "Throws: [thing that cannot throw]" should be "Throws: Nothing.". LWG 3358 addresses the normative defect that The LWG 3358 changes supersede this editorial change and are what we want. |
+1 to Jonathan's comments, and apologies for not rebasing the wording of LWG 3358 onto the result of the editorial change to avoid this confusion in the first place. |
N4842 22.7.3.2 [span.cons]/6 and /9 say: "Throws: When and what
to_address(first)
throws."But 20.10.2 [memory.syn] and 20.10.4 [pointer.conversion] require both overloads of
to_address()
to benoexcept
:Therefore, [span.cons]/6 and [span.cons]/9 should be removed editorially.
The text was updated successfully, but these errors were encountered: