NVIDIA / stdexec

`std::execution`, the proposed C++ framework for asynchronous and parallel programming.
Apache License 2.0
1.56k stars 159 forks source link

gcc trunk unhappy with just() #1285

Closed prlw1 closed 6 months ago

prlw1 commented 7 months ago

gcc trunk is unhappy with stdexec::just()

Simply trying gcc trunk on the godbolt README example gives

<source>: In function 'int main()':
<source>:23:45: error: no match for 'operator|' (operand types are 'void' and 'stdexec::__closure::__binder_back<stdexec::__then::then_t, main()::<lambda(int)> >')
   23 |         stdexec::on(sched, stdexec::just(0) | stdexec::then(fun)),
      |                            ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~
      |                                         |                  |
      |                                         void               stdexec::__closure::__binder_back<stdexec::__then::then_t, main()::<lambda(int)> >

async_scope.hpp is similarly unhappy:

/usr/src/local/stdexec/include/exec/async_scope.hpp: In member function 'auto exec::__scope::async_scope::on_empty() const':
/usr/src/local/stdexec/include/exec/async_scope.hpp:735:31: error: invalid use of void expression
  735 |         return when_empty(just());
      |                           ~~~~^~
ericniebler commented 7 months ago
/opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/execution.hpp:2623:31: error: invalid use of void expression
 2623 |           __make_sexpr<then_t>(static_cast<_Fun&&>(__fun), static_cast<_Sender&&>(__sndr)));
      |           ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

__make_sexpr invocations can't ever have type void. This seems like a bug in gcc-trunk to me. I suggest reporting it there.

prlw1 commented 7 months ago

How did you manage to get it to spit out that error message? (I don't see mention of __make_sexpr anywhere in my output.)

prlw1 commented 7 months ago

The gcc team are already on the case: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114393

prlw1 commented 6 months ago

and they fixed it! https://gcc.gnu.org/g:d74fe10b13336b9de2e025ced4af00a25ff1d3e7