diff --git a/include/stdexec/execution.hpp b/include/stdexec/execution.hpp index 95677cdcd..02a7095ae 100644 --- a/include/stdexec/execution.hpp +++ b/include/stdexec/execution.hpp @@ -3571,8 +3571,11 @@ namespace stdexec { using _Domain = __result_domain_t<_Set, _Child, _Fun, _Env, _Sched>; if constexpr (__merror<_Domain>) { return _Domain(); + } else if constexpr (same_as<_Domain, dependent_domain>) { + using _Domain2 = __late_domain_of_t<_Child, _Env>; + return __make_sexpr<__let_t<_Set, _Domain2>>((_Fun&&) __fun, (_Child&&) __child); } else { - static_assert(__none_of<_Domain, __none_such, dependent_domain>); + static_assert(!same_as<_Domain, __none_such>); return __make_sexpr<__let_t<_Set, _Domain>>((_Fun&&) __fun, (_Child&&) __child); } } diff --git a/test/stdexec/algos/adaptors/test_let_value.cpp b/test/stdexec/algos/adaptors/test_let_value.cpp index cfb7f8444..ecd85b6e6 100644 --- a/test/stdexec/algos/adaptors/test_let_value.cpp +++ b/test/stdexec/algos/adaptors/test_let_value.cpp @@ -316,4 +316,15 @@ namespace { | ex::let_value([](std::string& x) { return ex::just(x + ", world"); }); wait_for_value(std::move(snd), std::string{"hallo"}); } + + TEST_CASE("let_value can nest", "[adaptors][let_value]") { + auto work = ex::just(2) // + | ex::let_value([](int x) { // + return ex::just() // + | ex::let_value([=] { // + return ex::just(x); + }); + }); + wait_for_value(std::move(work), 2); + } }