Title
Dead code in the specification of default initialization
Status
cd1
Section
9.4 [dcl.init]
Submitter
Mike Miller

Created on 2005-03-18.00:00:00 last changed 189 months ago

Messages

Date: 2008-09-15.00:00:00

[Voted into the WP at the September, 2008 meeting (resolution in paper N2762).]

Date: 2008-09-15.00:00:00

Notes from the September, 2008 meeting:

The approach adopted in the resolution in paper N2762 was different from the suggestion above: it changes the definition of default initialization to include POD types and changes the third bullet to specify that “no initialization is performed.”

Date: 2022-02-18.07:47:23

The definition of default initialization (9.4 [dcl.init] paragraph 5) is:

  • if T is a non-POD class type (Clause 11 [class]), the default constructor for T is called (and the initialization is ill-formed if T has no accessible default constructor);

  • if T is an array type, each element is default-initialized;

  • otherwise, the object is zero-initialized.

However, default initialization is invoked only for non-POD class types and arrays thereof (7.6.2.8 [expr.new] paragraph 15 for new-expressions, 9.4 [dcl.init] paragraph 10 for top-level objects, and 11.9.3 [class.base.init] paragraph 4 for member and base class subobjects — but see issue 510). Consequently, all cases that invoke default initialization are handled by the first two bullets; the third bullet can never be reached. Its presence is misleading, so it should be removed.

History
Date User Action Args
2008-10-05 00:00:00adminsetmessages: + msg1824
2008-10-05 00:00:00adminsetmessages: + msg1823
2008-10-05 00:00:00adminsetstatus: open -> cd1
2005-03-18 00:00:00admincreate