Title
§[span.cons] is mistaken that to_address can throw
Status
c++20
Section
[span.cons]
Submitter
Casey Carter

Created on 2019-12-10.00:00:00 last changed 45 months ago

Messages

Date: 2020-01-14.13:40:39

Proposed resolution:

This wording is relative to N4842.

  1. Modify [span.cons] paragraphs 6 and 9 as indicated:

    [Drafting note:

    1. The missing paragraph number of the Preconditions element at p7/p8 has already been reported as editorial issue

    2. 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: Initializes data_ with to_address(first) and size_ with count.

    -6- Throws: When and what to_address(first) throwsNothing.

    template<class It, class End>
      constexpr span(It first, End last);
    

    […]

    -?- Preconditions: […]

    -8- Effects: Initializes data_ with to_address(first) and size_ with last - first.

    -9- Throws: When and what to_address(first)last - first throws.

Date: 2020-01-15.00:00:00

[ 2020-01-14; Daniel comments ]

The fixed wording in [span.cons] p9 depends on the no-throw-guarantee of integer-class conversions to integral types. This guarantee is specified by LWG 3367.

Date: 2020-01-14.00:00:00

[ 2020-01-14 Status set to Tentatively Ready after ten positive votes on the reflector. ]

Date: 2019-12-10.00:00:00

[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_ with to_address(first) and size_ with last - first.

must evaluate last - first.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2020-02-24 16:02:59adminsetstatus: immediate -> wp
2020-02-14 06:37:09adminsetstatus: ready -> immediate
2020-01-14 13:40:39adminsetmessages: + msg10934
2020-01-14 11:36:43adminsetmessages: + msg10927
2020-01-14 11:36:43adminsetstatus: new -> ready
2019-12-12 19:52:16adminsetmessages: + msg10889
2019-12-10 00:00:00admincreate