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

4227. Missing noexcept operator in [exec.when.all]

Section: 33.9.12.11 [exec.when.all] Status: New Submitter: Ian Petersen Opened: 2025-03-17 Last modified: 2025-03-22

Priority: Not Prioritized

View all issues with New status.

Discussion:

In 33.9.12.11 [exec.when.all] p7, the impls-for<when_all_t>::get-state member is defined to be equivalent to the following lambda:

[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept(e) -> decltype(e) {
  return e;
}

and e is later defined to be:

std::forward<Sndr>(sndr).apply(make-state<Rcvr>())

Together, the two definitions imply that the noexcept clause on the provided lambda is:

noexcept(std::forward<Sndr>(sndr).apply(make-state<Rcvr>()))

which is invalid.

Presumably, the lambda should be defined like so (with an extra noexcept operator in the noexcept clause):

[]<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept(noexcept(e)) -> decltype(e) {
  return e;
}

Proposed resolution:

This wording is relative to N5008.

  1. Modify 33.9.12.11 [exec.when.all] as indicated:

    -7- The member impls-for<when_all_t>::get-state is initialized with a callable object equivalent to the following lambda expression:

    []<class Sndr, class Rcvr>(Sndr&& sndr, Rcvr& rcvr) noexcept(noexcept(e)) -> decltype(e) {
      return e;
    }