Title
reference_wrapper::operator() should propagate noexcept
Status
c++23
Section
[refwrap.invoke]
Submitter
Zhihao Yuan

Created on 2022-08-31.00:00:00 last changed 5 months ago

Messages

Date: 2022-11-17.00:42:33

Proposed resolution:

This wording is relative to N4910.

  1. Modify [refwrap.general], class template reference_wrapper synopsis, as indicated:

    // [refwrap.invoke], invocation
    template<class... ArgTypes>
      constexpr invoke_result_t<T&, ArgTypes...> operator()(ArgTypes&&...) const 
        noexcept(is_nothrow_invocable_v<T&, ArgTypes...>);
    
  2. Modify [refwrap.invoke] as indicated:

    template<class... ArgTypes>
      constexpr invoke_result_t<T&, ArgTypes...>
        operator()(ArgTypes&&... args) const noexcept(is_nothrow_invocable_v<T&, ArgTypes...>);
    

    -1- Mandates: T is a complete type.

    -2- Returns: INVOKE(get(), std::forward<ArgTypes>(args)...). ([func.require])

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 six votes in favour during reflector poll.

Already implemented in MSVC and libstdc++.

Date: 2022-08-31.00:00:00

The following assertion does not hold, making the type less capable than the function pointers.

void f() noexcept;

std::reference_wrapper fn = f;
static_assert(std::is_nothrow_invocable_v<decltype(fn)>);
History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2022-11-17 00:42:33adminsetmessages: + msg13070
2022-11-17 00:42:33adminsetstatus: voting -> wp
2022-11-08 03:46:49adminsetstatus: ready -> voting
2022-09-23 15:43:32adminsetmessages: + msg12785
2022-09-23 15:43:32adminsetstatus: new -> ready
2022-09-03 17:25:47adminsetmessages: + msg12736
2022-08-31 00:00:00admincreate