Skip to content

Commit 502ccd9

Browse files
committed
stdexec::when_all: Nothrow Connect
get_state was missing noexcept and therefore stdexec::when_all senders were never nothrow connectable. This defect is present in std::execution and addressing it is LWG4502.
1 parent 58e39bf commit 502ccd9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

include/stdexec/__detail/__when_all.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ namespace stdexec {
310310
template <class _Receiver>
311311
static auto __mk_state_fn(const _Receiver&) noexcept {
312312
using __env_of_t = env_of_t<_Receiver>;
313-
return []<__max1_sender<__env_t<__env_of_t>>... _Child>(__ignore, __ignore, _Child&&...) {
313+
return []<__max1_sender<__env_t<__env_of_t>>... _Child>(__ignore, __ignore, _Child&&...) noexcept {
314314
using _Traits = __traits<__env_of_t, _Child...>;
315315
using _ErrorsVariant = _Traits::__errors_variant;
316316
using _ValuesTuple = _Traits::__values_tuple;
@@ -368,7 +368,7 @@ namespace stdexec {
368368
};
369369

370370
static constexpr auto get_state =
371-
[]<class _Self, class _Receiver>(_Self&& __self, _Receiver& __rcvr)
371+
[]<class _Self, class _Receiver>(_Self&& __self, _Receiver& __rcvr) noexcept
372372
-> __sexpr_apply_result_t<_Self, __mk_state_fn_t<_Receiver>> {
373373
return __sexpr_apply(static_cast<_Self&&>(__self), __when_all::__mk_state_fn(__rcvr));
374374
};

test/stdexec/algos/adaptors/test_when_all.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ namespace {
3333
TEST_CASE("when_all returns a sender", "[adaptors][when_all]") {
3434
auto snd = ex::when_all(ex::just(3), ex::just(0.1415));
3535
static_assert(ex::sender<decltype(snd)>);
36+
static_assert(noexcept(ex::connect(snd, expect_error_receiver{})));
3637
(void) snd;
3738
}
3839

0 commit comments

Comments
 (0)