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

2023-01-15


1093. Value-initializing non-objects

Section: 9.4  [dcl.init]     Status: CD3     Submitter: Daniel Krügler     Date: 2010-07-17

[Voted into the WP at the February, 2012 meeting; moved to DR at the October, 2012 meeting.]

9.4 [dcl.init] paragraph 7 only describes how to initialize objects:

To value-initialize an object of type T means:

However, 7.6.1.4 [expr.type.conv] paragraph 2 calls for value-initializing prvalues, which in the case of scalar types are not objects:

The expression T(), where T is a simple-type-specifier or typename-specifier for a non-array complete object type or the (possibly cv-qualified) void type, creates a prvalue of the specified type, which is value-initialized (9.4 [dcl.init]; no initialization is done for the void() case).

Proposed resolution (August, 2011):

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

The expression T(), where T is a simple-type-specifier or typename-specifier for a non-array complete object type or the (possibly cv-qualified) void type, creates a prvalue of the specified type,which is value-initialized (9.4 [dcl.init] type, whose value is that produced by value-initializing (9.4 [dcl.init]) an object of type T; no initialization is done for the void() case). [Note:...