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

2024-12-19


1502. Value initialization of unions with member initializers

Section: 9.4  [dcl.init]     Status: CD3     Submitter: Richard Smith     Date: 2012-05-06

[Moved to DR at the April, 2013 meeting.]

According to 9.4 [dcl.init] paragraph 7,

To value-initialize an object of type T means:

In an example like

  union U { int a = 5; };
  int main() { return U().a; }

this means that the value returned is 0, because none of the first three bullets apply. Should the “non-union” restriction be dropped from the second bullet?

Proposed resolution (October, 2012):

Change 9.4 [dcl.init] paragraph 7 as follows:

To value-initialize an object of type T means: