Title
Function-style cast with braced-init-lists and empty pack expansions
Status
cd5
Section
7.6.1.4 [expr.type.conv]
Submitter
Richard Smith

Created on 2014-03-13.00:00:00 last changed 48 months ago

Messages

Date: 2017-11-15.00:00:00

Proposed resolution (November, 2017)

Change 7.6.1.4 [expr.type.conv] paragraph 2 as follows:

If the initializer is a parenthesized single expression, the type conversion expression is equivalent to the corresponding cast expression (7.6.3 [expr.cast]). Otherwise, if the type is cv void and the initializer is () (after pack expansion, if any), the expression is a prvalue of the specified type that performs no initialization. Otherwise, the expression is a prvalue of the specified type whose result object is direct-initialized (9.4 [dcl.init]) with the initializer. For an expression of the form T(), T If the initializer is a parenthesized optional expression-list, the specified type shall not be an array type.
Date: 2014-06-15.00:00:00

Proposed resolution (June, 2014): [SUPERSEDED]

This issue is resolved by the resolution of issue 1299.

Date: 2018-03-15.00:00:00

[Accepted as a DR at the March, 2018 (Jacksonville) meeting.]

According to 7.6.1.4 [expr.type.conv] paragraph 1,

A simple-type-specifier (9.2.9.3 [dcl.type.simple]) or typename-specifier (13.8 [temp.res]) followed by a parenthesized expression-list constructs a value of the specified type given the expression list. If the expression list is a single expression, the type conversion expression is equivalent (in definedness, and if defined in meaning) to the corresponding cast expression (7.6.3 [expr.cast]). If the type specified is a class type, the class type shall be complete. If the expression list specifies more than a single value, the type shall be a class with a suitably declared constructor (9.4 [dcl.init], 11.4.5 [class.ctor]), and the expression T(x1, x2, ...) is equivalent in effect to the declaration T t(x1, x2, ...); for some invented temporary variable t, with the result being the value of t as a prvalue.

This does not cover the cases when the expression-list contains a single braced-init-list (which is neither an expression nor more than a single value) or if it contains no expressions as the result of an empty pack expansion.

History
Date User Action Args
2020-12-15 00:00:00adminsetstatus: dr -> cd5
2018-04-11 00:00:00adminsetstatus: tentatively ready -> dr
2018-02-27 00:00:00adminsetstatus: drafting -> tentatively ready
2015-04-13 00:00:00adminsetmessages: + msg5318
2014-11-24 00:00:00adminsetstatus: ready -> drafting
2014-07-07 00:00:00adminsetmessages: + msg5064
2014-07-07 00:00:00adminsetstatus: open -> ready
2014-03-13 00:00:00admincreate