Movatterモバイル変換


[0]ホーム

URL:


This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-12-20


1893. Function-style cast withbraced-init-lists and empty pack expansions

Section:7.6.1.4  [expr.type.conv]    Status:CD5    Submitter:Richard Smith    Date:2014-03-13

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

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

Asimple-type-specifier (9.2.9.3 [dcl.type.simple])ortypename-specifier (13.8 [temp.res]) followed by aparenthesizedexpression-list constructs a value of the specifiedtype given the expression list. If the expression list is a singleexpression, 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, theclass type shall be complete. If the expression list specifies more than asingle value, the type shall be a class with a suitably declaredconstructor (9.5 [dcl.init], 11.4.5 [class.ctor]), and theexpressionT(x1, x2, ...) is equivalent in effect to thedeclarationT t(x1, x2, ...); for some invented temporaryvariablet, with the result being the value oft as aprvalue.

This does not cover the cases when theexpression-listcontains a singlebraced-init-list (which is neither anexpression nor more than a single value) or if it contains noexpressions as the result of an empty pack expansion.

Proposed resolution (June, 2014): [SUPERSEDED]

This issue is resolved by the resolution ofissue 1299.

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 typeconversion expression is equivalent to the corresponding cast expression(7.6.3 [expr.cast]). Otherwise, if the type iscvvoid and the initializer is()(after packexpansion, if any), the expression is a prvalue of the specified typethat performs no initialization. Otherwise, the expression is a prvalue ofthe specified type whose result object is direct-initialized(9.5 [dcl.init]) with the initializer.For an expression ofthe formT(),TIf the initializer is aparenthesized optionalexpression-list, the specified typeshall not be an array type.



[8]ページ先頭

©2009-2026 Movatter.jp