4005. "Required behavior" too narrowly defined

Section: 3.47 [defns.required.behavior], 16.3.2.4 [structure.specifications], 16.4.5.8 [res.on.functions] Status: New Submitter: Eric Niebler Opened: 2023-11-03 Last modified: 2024-06-24

Priority: 2

View all issues with New status.

Discussion:

The library's definition of the term "required behavior" (3.47 [defns.required.behavior]) makes it specific to certain replaceable functions such as the replaceable global allocation functions. Notably, it is not one of the elements that are allowed to appear in the descriptions of general function semantics. That is, it isn't in the list in 16.3.2.4 [structure.specifications] p3.

However, the specification of the random number generator library uses "Required behavior" as such a descriptive element of its functions' semantics (e.g., 29.5.6 [rand.predef]).

I think that's a fine use of "Required behavior", so I would like the term to be more generally applicable to the behavior of any stdlib function that may be customized by users. This is relevant for std::execution, where algorithms are customizable but the customizations are required to behave a certain way.

Daniel:

Bullet (2.4) of 16.4.5.8 [res.on.functions] also contradicts to the more narrow definition of 3.47 [defns.required.behavior] by suddenly extending it to "destructor operations".

[2024-03-11; Reflector poll]

Set priority to 2 after reflector poll.

[2024-06-24; The approval of P2810R4 means that "required behavior" is now being incorrectly used in the working paper.]

Proposed resolution: