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


655. Initialization not specified for forwarding constructors

Section: 11.9.3  [class.base.init]     Status: C++11     Submitter: Alisdair Meredith     Date: 17 October 2007

[Voted into WP at August, 2010 meeting.]

The changes for delegating constructors overlooked the need to change 11.9.3 [class.base.init] paragraph 3:

The expression-list in a mem-initializer is used to initialize the base class or non-static data member subobject denoted by the mem-initializer-id. The semantics of a mem-initializer are as follows:

The initialization of each base and member constitutes a full-expression. Any expression in a mem-initializer is evaluated as part of the full-expression that performs the initialization.

This paragraph deals only with subobjects; it needs to be made more general to apply to the complete object as well when the mem-initializer-id designates the constructor's class.

Proposed resolution (June, 2008):

Change 11.9.3 [class.base.init] paragraph 3 as follows:

The expression-list in a mem-initializer is used to initialize the base class or non-static data member subobject denoted by the mem-initializer-id. The semantics of a mem-initializer are A mem-initializer in which the mem-initializer-id names the constructor's class initializes the object by invoking the selected target constructor with the mem-initializer's expression-list. A mem-initializer in which the mem-initializer-id names a base class or non-static data member initializes the designated subobject as follows:

...

The initialization of each base and member performed by each mem-initializer constitutes a full-expression. Any expression...

Notes from the September, 2008 meeting:

This text was significantly modified by N2756 (nonstatic data member initializers) and needs to be reworked in light of those changes.

Proposed resolution (February, 2010):

  1. Change 11.9.3 [class.base.init] paragraph 7 as follows:

  2. The expression-list or braced-init-list in a mem-initializer is used to initialize the base class or non-static data member subobject denoted by the mem-initializer-id designated subobject (or, in the case of a delegating constructor, the complete class object) according to the initialization rules of 9.4 [dcl.init] for direct-initialization.

    [Example: ...

    end example] The initialization of each base and member performed by each mem-initializer constitutes a full-expression...

  3. Change 11.9.3 [class.base.init] paragraph 8 as follows:

  4. If In a non-delegating constructor, if a given non-static data member or base class is not named by a mem-initializer-id...
  5. Change 11.9.3 [class.base.init] paragraph 10 as follows:

  6. Initialization In a non-delegating constructor, initialization proceeds in the following order:
  7. Change 11.9.3 [class.base.init] paragraph 12 as follows (this is an unrelated change correcting an error noticed while preparing the resolution of this issue):

  8. Names in the expression-list or braced-init-list of a mem-initializer are evaluated in the scope of the constructor...
  9. Change the next-to-last bullet of the note in 9.4.5 [dcl.init.list] paragraph 1 as follows: