Skip to content

check-values function for upon_error and upon_stopped is wrong #344

@ericniebler

Description

@ericniebler

this issue is from Trevor Gray.

in [exec.then]/p5, the impls-for<decayed-typeof<then-cpo>>::check-types function 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>.

Proposed resolution

In [exec.then]/p5, change the line:

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

to:

auto fn = []<class... Ts>(decayed-typeof<set-cpo>(*)(Ts...)) {

(where decayed-typeof and set-cpo are in italics).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions