NVIDIA / NVIDIA/stdexec

`sender_in` fails with GCC 13.1 due to `const completion_signatures` in `__constant_completion_signatures_v`

Open
#2,078 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary

A sender that compiles successfully with GCC 11.4 fails to compile with GCC 13.1 when passed to exec::start_detached.

The failure appears to come from the sender_in constraint. GCC 13.1 evaluates:

__constant_completion_signatures_v<STDEXEC::get_completion_signatures<_Sender, _Env...>()>

as false, apparently because decltype(_Completions) is const completion_signatures<...>.

GCC 11 succeeds because stdexec has a GCC < 13 workaround that removes const:

std::remove_const_t<decltype(_Completions)>

GCC 13 takes the other branch and does not remove const.

Reproducer

// reproducer.cpp
#include <stdexec/execution.hpp>
using S = decltype(stdexec::just());
static_assert(stdexec::sender_in<S, stdexec::__root_env>);
int main(){}

/* my usage:
#include <stdexec/execution.hpp>
#include <exec/start_detached.hpp>

int main(){
    stdexec::inline_scheduler sch;
    auto sender = stdexec::schedule(sch) | stdexec::then([]() noexcept {  });
    exec::start_detached(std::move(sender));
}
*/
cmake_minimum_required(VERSION 3.21)
project(issue_stdexec 
    VERSION 0.0.1 
    LANGUAGES CXX)

include(CPM.cmake)
CPMAddPackage(
  NAME stdexec
  GITHUB_REPOSITORY NVIDIA/stdexec
  GIT_TAG 6d7ad68
)

add_executable(reproducer reproducer.cpp)
target_link_libraries(reproducer PUBLIC STDEXEC::stdexec)
Environment

Linux GCC 11.4: compiles successfully
Linux GCC 13.1: fails
C++ mode: -std=gnu++20

Possible Cause

The issue may be related to stdexec/__detail/__sender_concepts.hpp #2027 :

#if STDEXEC_GCC() && STDEXEC_GCC_VERSION < 1300
  template <auto _Completions>
  inline constexpr bool __constant_completion_signatures_v =
    __valid_completion_signatures<std::remove_const_t<decltype(_Completions)>>;
#else
  template <auto _Completions>
  inline constexpr bool __constant_completion_signatures_v =
    __valid_completion_signatures<decltype(_Completions)>;
#endif

On GCC 13.1, the remove_const_t workaround still seems necessary.

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 stdexec/__detail/__sender_concepts.hpp, especially __constant_completion_signatures_v and its GCC version branches. Build the provided reproducer.cpp with GCC 11.4 and GCC 13.1 under C++20, then trace the sender_in constraint evaluation. Done means the reproducer compiles on GCC 13.1 without regressing the older compiler path.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.