Title
check-types function for `upon_error` and `upon_stopped` is wrong
Status
wp
Section
[exec.then]
Submitter
Eric Niebler

Created on 2025-08-31.00:00:00 last changed 1 month ago

Messages

Date: 2025-11-11.10:48:55

Proposed resolution:

This wording is relative to N5014.

  1. Modify [exec.then] as indicated:

    template<class Sndr, class... Env>
      static consteval void check-types();
    

    -5- Effects: Equivalent to:

    auto cs = get_completion_signatures<child-type<Sndr>, FWD-ENV-T(Env)...>();
    auto fn = []<class... Ts>(set_value_tdecayed-typeof<set-cpo>(*)(Ts...)) {
      if constexpr (!invocable<remove_cvref_t<data-type<Sndr>>, Ts...>)
        throw unspecified-exception();
    };
    cs.for-each(overload-set{fn, [](auto){}});
    

    where unspecified-exception is a type derived from `exception`.

Date: 2025-11-11.10:48:55

[ Kona 2025-11-08; Status changed: Immediate → WP. ]

Date: 2025-11-06.02:24:14

[ Kona 2025-11-06; approved by LWG. Status changed: New → Immediate. ]

Date: 2025-10-15.00:00:00

[ 2025-10-23; Reflector poll. ]

Set priority to 2 after reflector poll.

Date: 2025-11-06.02:24:14
Addresses US 219-350

The following has been reported by Trevor Gray:

In [exec.then] p5, the impls-for<decayed-typeof<then-cpo>>::check-types unction is specified as follows:

template<class Sndr, class... Env>
  static consteval void check-types();

Effects: Equivalent to:

auto cs = get_completion_signatures<child-type<Sndr>, FWD-ENV-T(Env)...>();
auto fn = []<class... Ts>(set_value_t(*)(Ts...)) {
  if constexpr (!invocable<remove_cvref_t<data-type<Sndr>>, Ts...>)
    throw unspecified-exception();
};
cs.for-each(overload-set{fn, [](auto){}});

where unspecified-exception is a type derived from `exception`.

The line auto fn = []<class... Ts>(set_value_t(*)(Ts...)) { is correct when then-cpo is `then` but not when it is `upon_error` or `upon_stopped`.

For `upon_error` it should be:

auto fn = []<class... Ts>(set_error_t(*)(Ts...)) {

and for `upon_stopped` it should be:

auto fn = []<class... Ts>(set_stopped_t(*)(Ts...)) {

We can achieve that by replacing `set_value_t` in the problematic line with decayed-typeof<set-cpo>.

History
Date User Action Args
2025-11-11 10:48:55adminsetmessages: + msg15675
2025-11-11 10:48:55adminsetstatus: immediate -> wp
2025-11-06 02:24:14adminsetmessages: + msg15542
2025-11-06 02:24:14adminsetstatus: new -> immediate
2025-10-23 12:39:14adminsetmessages: + msg15406
2025-09-15 15:26:59adminsetmessages: + msg15055
2025-08-31 00:00:00admincreate