3041. Unnecessary decay in reference_wrapper

Section: 23.14.5.1 [refwrap.const] Status: New Submitter: Agustín K-ballo Bergé Opened: 2017-12-04 Last modified: 2017-12-05

Priority: Not Prioritized

View all other issues in [refwrap.const].

View all issues with New status.

Discussion:

Another occurrence of unnecessary decay (P0777) was introduced by the resolution of LWG 2993. A decayed function/array type will never be the same type as reference_wrapper.

Proposed resolution:

This wording is relative to N4713.

  1. Change 23.14.5.1 [refwrap.const] as indicated:

    template<class U>
    reference_wrapper(U&& u) noexcept(see below);

    -1- Remarks: Let FUN denote the exposition-only functions

    void FUN(T&) noexcept;
    void FUN(T&&) = delete;
    

    This constructor shall not participate in overload resolution unless the expression FUN(declval<U>()) is well-formed and is_same_v<decay_tremove_cvref_t<U>, reference_wrapper> is false. The expression inside noexcept is equivalent to noexcept(FUN(declval<U>())).