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


1633. Copy-initialization in member initialization

Section: 9.4  [dcl.init]     Status: CD4     Submitter: Vinny Romano     Date: 2013-03-04

[Moved to DR at the November, 2014 meeting.]

According to 9.4 [dcl.init] paragraph 16,

The initialization that occurs in the forms

  T x(a);
  T x{a};

as well as in new expressions (7.6.2.8 [expr.new]), static_cast expressions (7.6.1.9 [expr.static.cast]), functional notation type conversions (7.6.1.4 [expr.type.conv]), and base and member initializers (11.9.3 [class.base.init]) is called direct-initialization.

This wording was overlooked when brace-or-equal-initializers were added to the language, permitting copy-initialization of members by use of the = form.

Proposed resolution (April, 2013):

Change 9.4 [dcl.init] paragraphs 15-16 as follows, removing the example in paragraph 15 and making it a single running sentence:

The initialization that occurs in the = form of a brace-or-equal-initializer or condition (8.5 [stmt.select]),

  T x = a;

as well as in argument passing, function return, throwing an exception (14.2 [except.throw]), handling an exception (14.4 [except.handle]), and aggregate member initialization (9.4.2 [dcl.init.aggr]), is called copy-initialization. [Note: Copy-initialization may invoke a move (12.8). —end note]

The initialization that occurs in the forms

  T x(a);
  T x{a};

as well as in new expressions (7.6.2.8 [expr.new]), static_cast expressions (5.2.9), functional notation type conversions (7.6.1.4 [expr.type.conv]), and base and member initializers mem-initializers (11.9.3 [class.base.init]), and the braced-init-list form of a condition is called direct-initialization.