NVIDIA / NVIDIA/stdexec

let_value does not propagate nothrow-connect-ness

Open
#1,442 2 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

Consider this code:

#include <stdexec/execution.hpp>
void test() {
    auto s1 = stdexec::let_value(
        stdexec::just(),
        []() noexcept {
            return stdexec::just();
        }
    );
    static_assert(stdexec::__detail::__connectable<decltype(s1), stdexec::__sync_wait::__receiver_t<decltype(s1)>>);    
    static_assert(stdexec::__nothrow_connectable<decltype(s1), stdexec::__sync_wait::__receiver_t<decltype(s1)>>);  // <                    
}

(Godbolt link: https://godbolt.org/z/hn5MG7dqe)

Compilation fails on the line marked with <, which suggests than s1 is a valid sender, but its connect CPO is declared as throwing.
This is surprising: as fas as I can see, there is no room for an exception in this code, since just() returns nothrow-connectable sender, and lambda itself is declared as non-throwing. let_value internal implementation is hard to follow (in particular, while reading [exec] I wasn't able to find what domain really is), so I can't pinpoint source of confusion any further.

Is this behavior intended?

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

Reproduce the Godbolt example and inspect stdexec/execution.hpp around let_value, __connectable, and __nothrow_connectable. Trace why the shown noexcept lambda and just() sender do not satisfy the nothrow assertion, then determine whether the behavior is intended and add or update regression coverage if a change is required.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.