Title
What's the effect of std::forward_like<void>(x)?
Status
c++23
Section
[forward]
Submitter
Jiang An

Created on 2022-08-24.00:00:00 last changed 12 months ago

Messages

Date: 2022-11-17.00:42:33

Proposed resolution:

This wording is relative to n4917.

  1. Modify [forward] as indicated:

    template<class T, class U>
      [[nodiscard]] constexpr auto forward_like(U&& x) noexcept -> see below;
    

    Mandates: T is a referenceable type ([defns.referenceable]).

    […]

Date: 2022-11-12.00:00:00

[ 2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Voting → WP. ]

Date: 2022-09-15.00:00:00

[ 2022-09-23; Reflector poll ]

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

Date: 2022-08-24.00:00:00

Currently the return type of std::forward_like is specified by the following bullet:

— Let V be

OVERRIDE_REF(T&&, COPY_CONST(remove_reference_t<T>, remove_reference_t<U>))

where T&& is not always valid, e.g. it's invalid when T is void.

A strait forward reading may suggest that there is a hard error when T is not referenceable (which is currently implemented in MSVC STL), but this seems not clarified. It is unclear to me whether the intent is that hard error, substitution failure, or no error is caused when T&& is invalid.

History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2022-11-17 00:42:33adminsetmessages: + msg13065
2022-11-17 00:42:33adminsetstatus: voting -> wp
2022-11-08 03:46:49adminsetstatus: ready -> voting
2022-09-23 15:43:32adminsetmessages: + msg12789
2022-09-23 15:43:32adminsetstatus: new -> ready
2022-09-03 12:26:00adminsetmessages: + msg12723
2022-08-24 00:00:00admincreate