Title
Value initialization and defaulted constructors
Status
cd3
Section
9.4 [dcl.init]
Submitter
Daniel Krügler

Created on 2011-05-22.00:00:00 last changed 130 months ago

Messages

Date: 2012-02-15.00:00:00

[Voted into the WP at the February, 2012 meeting; moved to DR at the October, 2012 meeting.]

Date: 2011-08-15.00:00:00

Proposed resolution (August, 2011):

This issue is resolved by the resolution of issue 1301.

Date: 2012-09-24.00:00:00

One would expect that an example like

  struct B {
   B(const B&) = default;
  };

  B b{};

would invoke value-initialization, but (because it does not have a default constructor), the logic ladder of 9.4.5 [dcl.init.list] paragraph 3 makes it aggregate initialization instead:

  • If the initializer list has no elements and T is a class type with a default constructor, the object is value-initialized.

  • Otherwise, if T is an aggregate, aggregate initialization is performed (9.4.2 [dcl.init.aggr]).

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2012-11-03 00:00:00adminsetstatus: dr -> drwp
2012-09-24 00:00:00adminsetmessages: + msg4007
2012-02-27 00:00:00adminsetmessages: + msg3816
2012-02-27 00:00:00adminsetstatus: ready -> dr
2011-05-22 00:00:00admincreate