Title
Const-default-constructible for members
Status
cd5
Section
11.4.5.2 [class.default.ctor]
Submitter
Richard Smith

Created on 2018-07-10.00:00:00 last changed 7 months ago

Messages

Date: 2018-11-15.00:00:00

Proposed resolution (November, 2018):

Change 11.4.5.2 [class.default.ctor] bullet 2.4 as follows:

A defaulted default constructor for class X is defined as deleted if:

  • ...

  • any non-variant non-static data member of const-qualified type (or array thereof) with no brace-or-equal-initializer does not have a user-provided default constructor is not const-default-constructible (9.4 [dcl.init]) ,

  • ...

Date: 2019-02-15.00:00:00

[Accepted as a DR at the February, 2019 meeting.]

After the changes for comment RU 1 in P0490R0, a defaulted default constructor is acceptable for default initialization of a const object under certain circumstances; for example,

   struct A {};
   const A a;

is well-formed. However, default-initialization of such a class member still requires a user-provided constructor:

   struct B { const A a; };
   B b;   //error
History
Date User Action Args
2020-12-15 00:00:00adminsetmessages: + msg6407
2018-07-10 00:00:00admincreate