Created on 2022-06-18.00:00:00 last changed 16 months ago
Proposed resolution (approved by CWG 2022-08-26):
Insert before 9.4.1 [dcl.init.general] paragraph 18 as follows:
An initializer-clause followed by an ellipsis is a pack expansion (13.7.4 [temp.variadic]).
Initialization includes the evaluation of all subexpressions of each initializer-clause of the initializer (possibly nested within braced-init-lists) and the creation of any temporary objects for function arguments or return values (6.7.7 [class.temporary]).
If the initializer is a parenthesized expression-list, the expressions are evaluated in the order specified for function calls (7.6.1.3 [expr.call]).
Suggested resolution [SUPERSEDED]:
Insert before 9.4.1 [dcl.init.general] paragraph 18 as follows:
An initializer-clause followed by an ellipsis is a pack expansion (13.7.4 [temp.variadic]).
Initialization includes the evaluation of all subexpressions of each initializer-clause of the initializer (possibly nested within braced-init-lists).
If the initializer is a parenthesized expression-list, the expressions are evaluated in the order specified for function calls (7.6.1.3 [expr.call]).
[Accepted as a DR at the November, 2022 meeting.]
Subclause 7.6.1.3 [expr.call] paragraph 8 specifies:
The postfix-expression is sequenced before each expression in the expression-list and any default argument. The initialization of a parameter, including every associated value computation and side effect, is indeterminately sequenced with respect to that of any other parameter. [Note 8: All side effects of argument evaluations are sequenced before the function is entered (see 6.9.1 [intro.execution]). —end note]
Consider:
f(std::unique_ptr<int>(new int),std::unique_ptr<int>(new int));
It is not clear from the phrasing whether the evaluation of each new int is part of the "initialization of [its] parameter" or whether only the initialization of f's parameters from the completed std::unique_ptr<int> objects is included. The note does not help, since it can be read as distinguishing argument evaluations from initialization.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-07-16 13:00:43 | admin | set | status: open -> c++23 |
2023-07-16 13:00:43 | admin | set | status: drwp -> open |
2023-02-18 18:43:04 | admin | set | status: dr -> drwp |
2022-11-25 05:14:04 | admin | set | status: ready -> dr |
2022-08-26 21:45:07 | admin | set | messages: + msg6907 |
2022-08-26 21:45:07 | admin | set | status: drafting -> ready |
2022-08-19 07:54:33 | admin | set | status: open -> drafting |
2022-06-21 06:51:53 | admin | set | messages: + msg6859 |
2022-06-18 00:00:00 | admin | create |