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


922. Implicit default constructor definitions and const variant members

Section: 11.4.5  [class.ctor]     Status: CD2     Submitter: Daveed Vandevoorde     Date: 19 June, 2009

[Voted into WP at March, 2010 meeting.]

According to 11.4.5 [class.ctor] paragraph 5,

An implicitly-declared default constructor for class X is defined as deleted if: ... any non-static data member of const-qualified type (or array thereof) does not have a user-provided default constructor, or...

It is not clear if this adequately covers the case in which some variant members are const-qualified but others are not. The intent of the restriction is to prevent creation of an object with uninitialized members that would require a const_cast to set their value later, but const-qualified members of an anonymous union in which other members are not const do not seem to present that problem.

Proposed resolution (October, 2009):

Change 11.4.5 [class.ctor] bullet 5.3 of the second list and add a fourth bullet as follows:

Proposed resolution (November, 2009):

Change 11.4.5 [class.ctor] bullet 5.3 of the second list and add two bullets as follows: