Title
Missing Returns: element in optional<T&>::emplace
Status
ready
Section
[optional.ref.assign]
Submitter
Giuseppe D'Angelo

Created on 2025-07-15.00:00:00 last changed 3 days ago

Messages

Date: 2025-08-28.11:23:49

Proposed resolution:

This wording is relative to N5014.

  1. Modify [optional.ref.assign] as indicated:

    template<class U>
      constexpr T& emplace(U&& u) noexcept(is_nothrow_constructible_v<T&, U>);
    

    -4- Constraints: […]

    -5- Effects: Equivalent to: convert-ref-init-val(std::forward<U>(u)).

    -?- Returns: *val.

Date: 2025-08-15.00:00:00

[ 2025-08-27; Reflector poll ]

Set status to Tentatively Ready after nine votes in favour during reflector poll.

Date: 2025-07-15.00:00:00

The specification for optional<T&>::emplace in [optional.ref.assign] is not specifying the returned value via a Returns: element; however the function does indeed return something (a T&). Such a Returns: element is there for the primary template's `emplace` (cf. [optional.assign]).

History
Date User Action Args
2025-08-28 11:23:49adminsetmessages: + msg14972
2025-08-28 11:23:49adminsetstatus: new -> ready
2025-07-26 16:08:13adminsetmessages: + msg14907
2025-07-15 00:00:00admincreate