This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Ready status.
Section: 26.11 [specialized.algorithms] Status: Ready Submitter: Jiang An Opened: 2021-10-23 Last modified: 2026-08-29
Priority: 3
View other active issues in [specialized.algorithms].
View all other issues in [specialized.algorithms].
View all issues with Ready status.
Discussion:
Most uninitialized memory algorithms (26.11 [specialized.algorithms]) are specified by
plain "Effects: Equivalent to:". According to 16.3.2.4 [structure.specifications]/4,
such wording requires propagation of "Constraints" of selected constructors. The first two
overloads of std::reduce (26.10.4 [reduce]) are specified similarly.
std, depend on "Constraints" in
the specifications of many standard library types (but not any user-defined type), which is
implementable but brings serious inconsistency.
Perhaps we should add "Mandates:" to these algorithms (except for algorithms in std::ranges).
[2022-01-29; Reflector poll]
Set priority to 3 after reflector poll.
Tim:
"P2. Not for this particular case (I'm pretty sure there'll be agreement
that this shouldn't induce any constraint), but for the more general
issue of "Effects: Equivalent to" propagating Constraints:;
I'm not sure that's the right approach in general (unlike the other elements,
Constraints: requires special handling beyond "use this code" and is
pretty hard to work through if we have a lengthy code block) - and it
certainly doesn't really make a lot of sense to propagate Constraints:
but not actual core-language constraints."
[2026-08-28; Tim provides wording]
I believe that a careful reading of the existing wording already shows that "Equivalent to:" has no effect of the sort claimed. But since that appears to be a common misinterpretation, this wording adds a note to put it to rest.
[2026-08-28 LWG telecon; Status changed: New → Ready.]
Proposed resolution:
This wording is relative to N5054.
Modify 16.3.2.4 [structure.specifications] as indicated:
-4- Whenever the Effects element specifies that the semantics of some function
Fare Equivalent to some code sequence, then the various elements are interpreted as follows. IfF's semantics specifies any Constraints or Mandates elements, then those requirements are logically imposed prior to the equivalent-to semantics. Next, the semantics of the code sequence are determined by the Constraints, Mandates, Constant When, Preconditions, Hardened preconditions, Effects, Synchronization, Postconditions, Returns, Throws, Complexity, Remarks, and Error conditions specified for the function invocations contained in the code sequence. The value returned fromFis specified byF's Returns element, or ifFhas no Returns element, a non-void return fromFis specified by the return statements (8.8.4 [stmt.return]) in the code sequence. IfF's semantics contains a Throws, Postconditions, or Complexity element, then that supersedes any occurrences of that element in the code sequence. [Note ?: In particular, if a function call in the code sequence fails to find a viable candidate, whether by reason of a Constraints element on the called function or otherwise, that function call (and possibly the entire code sequence) is ill-formed. There is no requirement thatFitself not participate in overload resolution in such cases. — end note]