This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
to_address
can throwSection: 23.7.2.2.2 [span.cons] Status: C++20 Submitter: Casey Carter Opened: 2019-12-10 Last modified: 2021-02-25
Priority: 0
View all other issues in [span.cons].
View all issues with C++20 status.
Discussion:
[span.cons] paragraphs 6 and 9:
Throws: When and what
to_address(first)
throws.
could equivalently be "Throws: Nothing." since all overloads of std::to_address
are
noexcept
. However, paragraph 9 fails to account for the fact that paragraph 8:
Effects: Initializes
data_
withto_address(first)
andsize_
withlast - first
.
must evaluate last - first
.
[2020-01-14 Status set to Tentatively Ready after ten positive votes on the reflector.]
[2020-01-14; Daniel comments]
The fixed wording in 23.7.2.2.2 [span.cons] p9 depends on the no-throw-guarantee of integer-class conversions to integral types. This guarantee is specified by LWG 3367(i).
Proposed resolution:
This wording is relative to N4842.
Modify 23.7.2.2.2 [span.cons] paragraphs 6 and 9 as indicated:
[Drafting note:
]
The missing paragraph number of the Preconditions element at p7/p8 has already been reported as editorial issue
The effective change to "Throws: Nothing." in p6 has already been applied editorially.
template<class It> constexpr span(It first, size_type count);[…]
-4- Preconditions: […] -5- Effects: Initializesdata_
withto_address(first)
andsize_
withcount
. -6- Throws:When and whatNothing.to_address(first)
throwstemplate<class It, class End> constexpr span(It first, End last);[…]
-?- Preconditions: […] -8- Effects: Initializesdata_
withto_address(first)
andsize_
withlast - first
. -9- Throws: When and whatthrows.
to_address(first)last - first