NVIDIA/stdexec

nested `let_value`s confundles the result domain computation

ericniebler opened this issue · 0 comments

Discussed in #1217

Originally posted by SamGaaWaa January 22, 2024
godbolt

#include <stdexec/execution.hpp>

namespace ex = stdexec;

int main()
{
    auto work = ex::just(2) |
                ex::let_value([](int x){
                    return  ex::just() |
                            ex::let_value([=]{
                                return ex::just(x);
                            });
                });
    
    ex::sync_wait(std::move(work));
}
In file included from <source>:1:
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/execution.hpp: In instantiation of 'stdexec::__let::__mk_transform_sender_fn<__let_t<stdexec::__receivers::set_value_t>, stdexec::__sync_wait::__env>(const stdexec::__sync_wait::__env&)::<lambda(stdexec::__ignore, _Fun&&, _Child&&)> [with _Fun = main()::<lambda(int)>; _Child = stdexec::__sexpr<stdexec::__detail::{anonymous}::<lambda(_Tag, _Captures&& ...)>::<lambda(_Cvref, _Fun&&)> >]':
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__concepts.hpp:27:23:   required by substitution of 'template<class _Cvref, class _Fun> stdexec::__detail::{anonymous}::<lambda(_Tag, _Captures&& ...)>::<lambda(_Cvref, _Fun&&)> mutable [with _Cvref = stdexec::__let::__let_t<stdexec::__receivers::set_value_t>; _Fun = {stdexec::__detail::__mbc<main()::<lambda(int)> >, stdexec::__detail::__mbc<stdexec::__sexpr<stdexec::__detail::{anonymous}::<lambda(_Tag, _Captures&& ...)>::<lambda(_Cvref, _Fun&&)> > >}]'
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__meta.hpp:745:53:   required by substitution of 'template<class _Fun, class ... _As> using __call_result_t = decltype (__declval<_Fun>()((__declval<_As>)()...)) [with _Fun = stdexec::__detail::{anonymous}::<lambda(_Tag, _Captures&& ...)>::<lambda(_Cvref, _Fun&&)>&&; _As = {stdexec::__cp, stdexec::__let::__mk_transform_sender_fn<__let_t<stdexec::__receivers::set_value_t>, stdexec::__sync_wait::__env>(const stdexec::__sync_wait::__env&)::<lambda(stdexec::__ignore, _Fun&&, _Child&&)>}]'
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__basic_sender.hpp:493:5:   required by substitution of 'template<class _Sender, class _ApplyFn> static stdexec::__call_result_t<decltype (__declval<_Sender>().__impl_), decltype (__cpcvr<_Sender>), _ApplyFn> stdexec::__sexpr<stdexec::__detail::{anonymous}::<lambda(_Tag, _Captures&& ...)>::<lambda(_Cvref, _Fun&&)> >::apply(_Sender&&, _ApplyFn&&) [with _Sender = stdexec::__sexpr<stdexec::__detail::{anonymous}::<lambda(_Tag, _Captures&& ...)>::<lambda(_Cvref, _Fun&&)> >; _ApplyFn = stdexec::__let::__mk_transform_sender_fn<__let_t<stdexec::__receivers::set_value_t>, stdexec::__sync_wait::__env>(const stdexec::__sync_wait::__env&)::<lambda(stdexec::__ignore, _Fun&&, _Child&&)>]'
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__basic_sender.hpp:623:21:   required by substitution of 'template<class _Sender, class _ApplyFn> decltype ((_Sender&&)(__sndr).apply((_Sender&&)(__sndr), (_ApplyFn&&)(__fun))) stdexec::__detail::__sexpr_apply_t::operator()(_Sender&&, _ApplyFn&&) const [with _Sender = stdexec::__sexpr<stdexec::__detail::{anonymous}::<lambda(_Tag, _Captures&& ...)>::<lambda(_Cvref, _Fun&&)> >; _ApplyFn = stdexec::__let::__mk_transform_sender_fn<__let_t<stdexec::__receivers::set_value_t>, stdexec::__sync_wait::__env>(const stdexec::__sync_wait::__env&)::<lambda(stdexec::__ignore, _Fun&&, _Child&&)>]'
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/execution.hpp:3647:29:   required from 'static decltype(auto) stdexec::__let::__let_t<_Set, _Domain>::transform_sender(_Sender&&, const _Env&) [with _Sender = stdexec::__sexpr<stdexec::__detail::{anonymous}::<lambda(_Tag, _Captures&& ...)>::<lambda(_Cvref, _Fun&&)> >; _Env = stdexec::__sync_wait::__env; _Set = stdexec::__receivers::set_value_t; _Domain = stdexec::dependent_domain]'
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__domain.hpp:55:31:   [ skipping 11 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__meta.hpp:745:53:   required by substitution of 'template<class _Fun, class ... _As> using __call_result_t = decltype (__declval<_Fun>()((__declval<_As>)()...)) [with _Fun = stdexec::transform_sender_t; _As = {stdexec::default_domain, stdexec::__sexpr<stdexec::__detail::{anonymous}::<lambda(_Tag, _Captures&& ...)>::<lambda(_Cvref, _Fun&&)> >, stdexec::__sync_wait::__env}]'
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/execution.hpp:642:9:   required by substitution of 'template<class _Domain, class _Sender, class ... _Env> using transform_sender_result_t = stdexec::__call_result_t<stdexec::transform_sender_t, _Domain, _Sender, _Env ...> [with _Domain = stdexec::default_domain; _Sender = stdexec::__sexpr<stdexec::__detail::{anonymous}::<lambda(_Tag, _Captures&& ...)>::<lambda(_Cvref, _Fun&&)> >; _Env = {stdexec::__sync_wait::__env}]'
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/execution.hpp:714:11:   required by substitution of 'template<class _Sender, class _Env> using __tfx_sender = stdexec::transform_sender_result_t<decltype (stdexec::__declval<__get_late_domain_t>()(__declval<_Sender>(), __declval<_Env>())), _Sender, _Env> [with _Sender = stdexec::__sexpr<stdexec::__detail::{anonymous}::<lambda(_Tag, _Captures&& ...)>::<lambda(_Cvref, _Fun&&)> >; _Env = stdexec::__sync_wait::__env]'
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/execution.hpp:735:15:   required from 'static auto stdexec::__get_completion_signatures::get_completion_signatures_t::__impl() [with _Sender = stdexec::__sexpr<stdexec::__detail::{anonymous}::<lambda(_Tag, _Captures&& ...)>::<lambda(_Cvref, _Fun&&)> >; _Env = stdexec::__sync_wait::__env]'
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/execution.hpp:772:42:   required by substitution of 'template<class _Sender, class _Env> constexpr decltype (__impl<_Sender, _Env>()()) stdexec::__get_completion_signatures::get_completion_signatures_t::operator()(_Sender&&, const _Env&) const [with _Sender = stdexec::__sexpr<stdexec::__detail::{anonymous}::<lambda(_Tag, _Captures&& ...)>::<lambda(_Cvref, _Fun&&)> >; _Env = stdexec::__sync_wait::__env]'
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/execution.hpp:811:34:   required by substitution of 'template<class _Sender>  requires (sender_in<_Sender, stdexec::__sync_wait::__env>) && ((__valid_sync_wait_argument<_Sender>) && (__has_implementation_for<stdexec::__sync_wait::sync_wait_t, decltype((__declval()())((__declval<_Sender>)(), __declval()())), _Sender>)) std::optional<typename stdexec::__sync_wait::__value_tuple_for<_Sender>::__t> stdexec::__sync_wait::sync_wait_t::operator()(_Sender&&) const [with _Sender = stdexec::__sexpr<stdexec::__detail::{anonymous}::<lambda(_Tag, _Captures&& ...)>::<lambda(_Cvref, _Fun&&)> >]'
<source>:15:18:   required from here
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/execution.hpp:3575:27: error: static assertion failed
 3575 |             static_assert(__none_of<_Domain, __none_such, dependent_domain>);
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/execution.hpp:3575:27: note: constraints not satisfied
In file included from /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__meta.hpp:24,
                 from /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__execution_fwd.hpp:19,
                 from /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/execution.hpp:31:
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__concepts.hpp:90:11:   required by the constraints of 'template<class _Ty, class ... _Us> concept stdexec::__none_of'
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__concepts.hpp:90:49: note: the expression '(!(__same_as<_Ty, _Us>) && ...) [with _Ty = stdexec::dependent_domain; _Us = {stdexec::__none_such, stdexec::dependent_domain}]' evaluated to 'false'
   90 |   concept __none_of = ((!__same_as<_Ty, _Us>) &&...);
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
Compiler returned: 1