Skip to content

compilation error: exec::task with inline context spawn with a scheduler #1995

@SamGaaWaa

Description

@SamGaaWaa
#include <exec/task.hpp>

template <class T>
using Task = exec::basic_task<T, exec::__task::inline_task_context<T>>;

Task<void> test() {
    co_return;
}

int main() {
    stdexec::sync_wait(stdexec::starts_on(
        stdexec::inline_scheduler{},
        test()
    ));
}
/opt/compiler-explorer/libs/stdexec/trunk/include/exec/task.hpp:492:16: error: too few template arguments for class template '__task_awaiter'
  492 |         return __task_awaiter<>{std::exchange(__coro_, {})};
      |                ^
/opt/compiler-explorer/libs/stdexec/trunk/include/exec/../stdexec/__detail/../__detail/__awaitable.hpp:60:54: note: in instantiation of member function 'experimental::execution::__task::basic_task<void, experimental::execution::__task::__default_task_context_impl<experimental::execution::__task::__scheduler_affinity::__none>>::operator co_await' requested here
   60 |       return static_cast<_Awaitable &&>(__awaitable).operator co_await();
      |                                                      ^
/opt/compiler-explorer/libs/stdexec/trunk/include/exec/../stdexec/__detail/../__detail/__awaitable.hpp:78:7: note: in instantiation of function template specialization 'stdexec::(lambda)::operator()<experimental::execution::__task::basic_task<void, experimental::execution::__task::__default_task_context_impl<experimental::execution::__task::__scheduler_affinity::__none>>>' requested here
   78 |       STDEXEC::__get_awaiter(
      |       ^
/opt/compiler-explorer/libs/stdexec/trunk/include/exec/../stdexec/__detail/__config.hpp:190:19: note: expanded from macro 'STDEXEC'
  190 | #  define STDEXEC stdexec
      |                   ^
/opt/compiler-explorer/libs/stdexec/trunk/include/exec/../stdexec/__detail/../__detail/__awaitable.hpp:78:7: note: in instantiation of requirement here
   78 |       STDEXEC::__get_awaiter(
      |       ^~~~~~~~~~~~~~~~~~~~~~~
   79 |         STDEXEC::__get_awaitable(static_cast<_Awaitable &&>(__awaitable), __promise...))
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/compiler-explorer/libs/stdexec/trunk/include/exec/../stdexec/__detail/__config.hpp:190:19: note: expanded from macro 'STDEXEC'
  190 | #  define STDEXEC stdexec
      |                   ^
/opt/compiler-explorer/libs/stdexec/trunk/include/exec/../stdexec/__detail/../__detail/__awaitable.hpp:76:25: note: while substituting template arguments into constraint expression here
   76 |   concept __awaitable = requires(_Awaitable &&__awaitable, _Promise &...__promise) {
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   77 |     {
      |     ~
   78 |       STDEXEC::__get_awaiter(
      |       ~~~~~~~~~~~~~~~~~~~~~~~
   79 |         STDEXEC::__get_awaitable(static_cast<_Awaitable &&>(__awaitable), __promise...))
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   80 |     } -> __awaiter<_Promise...>;
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   81 |   };
      |   ~
/opt/compiler-explorer/libs/stdexec/trunk/include/exec/../stdexec/__detail/__get_completion_signatures.hpp:151:31: note: while checking the satisfaction of concept '__awaitable<experimental::execution::__task::basic_task<void, experimental::execution::__task::__default_task_context_impl<experimental::execution::__task::__scheduler_affinity::__none>>>' requested here
  151 |     concept __with_co_await = __awaitable<_Sender, __detail::__promise<_Env>...>;
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/compiler-explorer/libs/stdexec/trunk/include/exec/../stdexec/__detail/__get_completion_signatures.hpp:204:26: note: (skipping 45 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
  204 |       else if constexpr (__with_co_await<_Sender>)
      |                          ^
/opt/compiler-explorer/libs/stdexec/trunk/include/exec/../stdexec/__detail/__sender_concepts.hpp:58:46: note: while checking the satisfaction of concept '__valid_completion_signatures<__sexpr_t<stdexec::starts_on_t, stdexec::inline_scheduler, experimental::execution::__task::basic_task<void, experimental::execution::__task::__default_task_context_impl<experimental::execution::__task::__scheduler_affinity::__none>>>>' requested here
   58 |   concept __constant_completion_signatures = __valid_completion_signatures<decltype(_Completions)>;
      |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/compiler-explorer/libs/stdexec/trunk/include/exec/../stdexec/__detail/__sender_concepts.hpp:64:8: note: while checking the satisfaction of concept '__constant_completion_signatures<__sexpr_t<stdexec::starts_on_t, stdexec::inline_scheduler, experimental::execution::__task::basic_task<void, experimental::execution::__task::__default_task_context_impl<experimental::execution::__task::__scheduler_affinity::__none>>>>' requested here
   64 |     && __constant_completion_signatures<STDEXEC::get_completion_signatures<_Sender, _Env...>()>;
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/compiler-explorer/libs/stdexec/trunk/include/exec/../stdexec/__detail/__senders.hpp:64:34: note: while checking the satisfaction of concept 'sender_in<__sexpr_t<stdexec::starts_on_t, stdexec::inline_scheduler, experimental::execution::__task::basic_task<void, experimental::execution::__task::__default_task_context_impl<experimental::execution::__task::__scheduler_affinity::__none>>>>' requested here
   64 |   concept __well_formed_sender = sender_in<_Sender> || dependent_sender<_Sender>;
      |                                  ^~~~~~~~~~~~~~~~~~
/opt/compiler-explorer/libs/stdexec/trunk/include/exec/../stdexec/__detail/__starts_on.hpp:111:65: note: while checking the satisfaction of concept '__well_formed_sender<__sexpr_t<stdexec::starts_on_t, stdexec::inline_scheduler, experimental::execution::__task::basic_task<void, experimental::execution::__task::__default_task_context_impl<experimental::execution::__task::__scheduler_affinity::__none>>>>' requested here
  111 |     operator()(_Scheduler&& __sched, _Sender&& __sndr) const -> __well_formed_sender auto
      |                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
<source>:11:42: note: in instantiation of function template specialization 'stdexec::starts_on_t::operator()<stdexec::inline_scheduler, experimental::execution::__task::basic_task<void, experimental::execution::__task::__default_task_context_impl<experimental::execution::__task::__scheduler_affinity::__none>>>' requested here
   11 |     stdexec::sync_wait(stdexec::starts_on(
      |                                          ^
/opt/compiler-explorer/libs/stdexec/trunk/include/exec/task.hpp:610:14: note: template is declared here
  609 |       template <class _ParentPromise>
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  610 |       struct __task_awaiter

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions