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

2024-04-18


1677. Constant initialization via aggregate initialization

Section: 6.9.3.2  [basic.start.static]     Status: C++17     Submitter: Daniel Krügler     Date: 2013-05-05

[Adopted at the February/March, 2017 meeting.]

The resolution of issue 1489 added wording regarding value initialization to 6.9.3.2 [basic.start.static] paragraph 2 in an attempt to clarify the status of an example like

  int a[1000]{};

However, this example is aggregate initialization, not value initialization. Also, now that we allow brace-or-equal-initializers in aggregates, this wording also needs to be updated to allow an aggregate with constant non-static data member initializers to qualify for constant initialization.

Proposed resolution (November, 2016):

  1. Change 6.9.3.2 [basic.start.static] paragraph 2 as follows, converting the bulleted list into running text as indicated:

  2. A constant initializer for an a variable or temporary object o is an expression that initializer whose full-expression is a constant expression, except that it if o is an object, such an initializer may also invoke constexpr constructors for o and its subobjects even if those objects are of non-literal class types. [Note: Such a class may have a non-trivial destructor —end note] Constant initialization is performed:

    If constant initialization is not performed...

  3. Change 7.7 [expr.const] paragraph 2 as follows:

    A conditional-expression An expression e is a core constant expression unless...