Skip to content

gcc compilation failure with simple sender algorithm forwarding one with let_error/let_stopped (works with clang) #1626

@kyusic

Description

@kyusic

Hello,
I encountered an issue when compiling the following code with gcc (version 14.2) using the latest stdexec commit (ac2d378).
The code defines a very simple sender algorithm that forwards another sender by wrapping it and then returns a new sender that should behave identically.

Here is a minimal reproducible example:

struct simply_forward_t {
  template <typename S> struct sender {
    using sender_concept = stdexec::sender_t;

    S s;

    template <typename Env>
    constexpr auto get_completion_signatures(Env &&) const noexcept
        -> stdexec::completion_signatures_of_t<S, Env> {
      return {};
    }

    template <typename Receiver>
    stdexec::operation_state auto connect(Receiver &&r) && {
      return stdexec::connect(std::move(s), static_cast<Receiver &&>(r));
    }
  };

  template <stdexec::sender S> stdexec::sender auto operator()(S &&s) const {
    return sender<std::remove_cvref_t<S>>{std::forward<S>(s)};
  }

} inline constexpr simply_forward;

exec::task<void> g() { co_return; }

exec::task<void> f() {
  co_await simply_forward(
      g() | stdexec::let_error([](auto) { return stdexec::just(); }) |
      stdexec::let_stopped([] { return stdexec::just(); }));
};

The compilation fails with gcc-14.2.

The error message is quite long, so I have attached it as a separate file for your reference.

error_message.txt

For comparison, the same code compiles successfully with clang-17 and clang-20.
My question is:
Is there something wrong with the simply_forward_t implementation, or could this be a gcc-specific issue?
Any insights or advice would be greatly appreciated.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions