This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.

3757. What's the effect of std::forward_like<void>(x)?

Section: 22.2.4 [forward] Status: WP Submitter: Jiang An Opened: 2022-08-24 Last modified: 2022-11-17

Priority: Not Prioritized

View all other issues in [forward].

View all issues with WP status.

Discussion:

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.

[2022-09-23; Reflector poll]

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

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

Proposed resolution:

This wording is relative to N4917.

  1. Modify 22.2.4 [forward] as indicated:

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

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

    […]