Skip to content

<execution>: execution policies lure users into writing nonportable code #5567

@localspook

Description

@localspook

The standard defines execution policies like so:

class parallel_policy { /* unspecified */ };
inline constexpr parallel_policy par { /* unspecified */ };

Nothing guarantees that execution policies are movable, copyable, or default constructible, and portable code cannot assume they are, but, because they look so much like tag types (and indeed are tag types in all major implementations), users can very easily assume that they behave no different than true tag types like from_range_t. To prevent users from making nonportable assumptions, we should make these types impossible to construct, copy, or move. libc++ and stdexec already do this, libstdc++ does not.

If we’re concerned about breaking users, we can do a gradual migration: keep the default constructors and special member functions, but mark them all [[deprecated]] with a helpful message, and only = delete them later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions