This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Immediate status.

4260. Query objects must be default constructible

Section: 33.2.1 [exec.queryable.general] Status: Immediate Submitter: Eric Niebler Opened: 2025-05-07 Last modified: 2025-11-07

Priority: 2

View all issues with Immediate status.

Discussion:

Imported from cplusplus/sender-receiver #333.

We require the types of query objects such as get_scheduler to be customization point objects. 16.3.3.3.5 [customization.point.object] requires them to be semiregular but that concept does not require default constructability. Much of std::execution assumes query object types to be default constructible.

I propose adding a (nothrow) default-constructibility requirement.

[2025-10-23; Reflector poll.]

Set priority to 2 after reflector poll.

"The discussion is wrong, semiregular requires default_initializable. If we want to mandate nothrow construction (a.k.a the implementation isn't out to get you), I'd rather we do it for all CPOs."

Previous resolution [SUPERSEDED]:

This wording is relative to N5008.

  1. Modify 33.2.1 [exec.queryable.general] as indicated:

    -1- A queryable object is a read-only collection of key/value pair where each key is a customization point object known as a query object. The type of a query object satisfies default_initializable, and its default constructor is not potentially throwing. A query is an invocation of a query object with a queryable object as its first argument and a (possibly empty) set of additional arguments. A query imposes syntactic and semantic requirements on its invocations.

[2025-11-05; Tim provides improved wording]

LWG decided to guarantee some additional properties for CPOs.

[Kona 2025-11-07; approved by LWG. Status changed: New → Immediate.]

Proposed resolution:

This wording is relative to N5014.

  1. Modify 16.3.3.3.5 [customization.point.object] as indicated:

    -1- A customization point object is a function object (22.10 [function.objects]) with a literal class type that interacts with program-defined types while enforcing semantic requirements on that interaction.

    -2- The type of a customization point object, ignoring cv-qualifiers, shall model semiregular (18.6 [concepts.object]) and shall be a structural type (13.2 [temp.param]) and a trivially copyable type (11.2 [class.prop]). Every constructor of this type shall have a non-throwing exception specification (14.5 [except.spec]).