NVIDIA / NVIDIA/stdexec

`stdexec::env` brace-initializer with a single argument fails for `clang`

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

I don't have time to trace back this compiler failure but here is a Godbolt reproducer.

Basically, the code is:

#include "stdexec/execution.hpp"

struct CustomProperty
{
    template <typename Env> requires ::stdexec::tag_invocable<CustomProperty, Env>
    constexpr decltype(auto) operator()(Env&& env) const {
        return ::stdexec::tag_invoke(*this, std::forward<Env>(env));
    }
};

constexpr CustomProperty my_custom_property {};

int main()
{
    constexpr auto env = ::stdexec::env{::stdexec::prop{my_custom_property, 123}};

    static_assert(my_custom_property(env) == 123);
}

and with clang (19 or 20) it fails (gcc 13 also fails but gcc 15 is fine):

<source>:18:81: error: missing field '__elem1' initializer [-Werror,-Wmissing-field-initializers]
   18 |     constexpr auto env = ::stdexec::env{::stdexec::prop{my_custom_property, 123}};

I'm not sure whether this is due to a new recent commit but it used to work just fine a few weeks ago. Today I'm using e5dbe49a5257d29adee456f9f653acb00df634f5.

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 Godbolt reproducer using stdexec/execution.hpp and compare the clang 19/20 and GCC behavior at commit e5dbe49a5257d29adee456f9f653acb00df6345. Investigate why the single-argument stdexec::env initializer triggers -Wmissing-field-initializers, then verify that the example compiles and its static_assert passes under clang without breaking the GCC behavior.

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
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.