NVIDIA / NVIDIA/stdexec

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

Open
#1,626 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
2.4k
Forks
270
Avg merge
3d 6h
Merged PRs (30d)
39

Description

Hello,
I encountered an issue when compiling the following code with gcc (version 14.2) using the latest stdexec commit (ac2d378944b68021a3c51ed98987b6d4cf05b989).
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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal reproducer in the issue and compile it with GCC 14.2, then compare the result with Clang 17 or 20. Read the attached error_message.txt and inspect the simply_forward_t implementation with the let_error and let_stopped pipeline; done means determining whether the failure is in the implementation or GCC and documenting the cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.