diff --git a/include/stdexec/__detail/__let.hpp b/include/stdexec/__detail/__let.hpp index 9777fccc3..6fda73d36 100644 --- a/include/stdexec/__detail/__let.hpp +++ b/include/stdexec/__detail/__let.hpp @@ -565,6 +565,24 @@ namespace STDEXEC using __what_t = __bad_result_sender_t<__sndr2_t, _LetTag, __env2_t<_Child, _Env>...>; return STDEXEC::__throw_compile_time_error(__what_t()); } + else if constexpr (__nothrow_decay_copyable<_Args...> + && __nothrow_invocable<_Fun, __decay_t<_Args>&...> + && sizeof...(_Env) == 0) + { + auto __completions = + STDEXEC::get_completion_signatures<__sndr2_t, __env2_t<_Child, _Env>...>(); + STDEXEC_IF_OK(__completions) + { + if constexpr (__completions.template __contains<__eptr_sig_t>()) + { + return __completions; + } + else + { + return STDEXEC::__throw_dependent_sender_error<__sndr2_t>(); + } + } + } else if constexpr (__nothrow_decay_copyable<_Args...> && __nothrow_invocable<_Fun, __decay_t<_Args>&...> && (__nothrow_connectable<__sndr2_t, __rcvr2_t<_Child, _Env>> diff --git a/test/stdexec/algos/adaptors/test_let_error.cpp b/test/stdexec/algos/adaptors/test_let_error.cpp index 0375004f3..ef9541618 100644 --- a/test/stdexec/algos/adaptors/test_let_error.cpp +++ b/test/stdexec/algos/adaptors/test_let_error.cpp @@ -100,6 +100,16 @@ namespace STDEXEC::sync_wait(std::move(snd)); } + TEST_CASE("let_error can be followed by upon_error", "[adaptors][let_error]") + { + auto snd = ex::just_error(2) + | ex::let_error([](int n) noexcept { return ex::just_error(n * 10); }) + | ex::upon_error([](int n) noexcept { return n + 3; }); + auto opt = ex::sync_wait(std::move(snd)); + REQUIRE(opt.has_value()); + CHECK(std::get<0>(*opt) == 23); + } + #if !STDEXEC_NO_STDCPP_EXCEPTIONS() TEST_CASE("let_error can be used to produce values (error to value)", "[adaptors][let_error]") {