Title
Implicitly-deleted default constructors and member initializers
Status
cd2
Section
11.4.5 [class.ctor]
Submitter
Alisdair Meredith

Created on 2009-07-01.00:00:00 last changed 143 months ago

Messages

Date: 2010-03-15.00:00:00

[Voted into WP at March, 2010 meeting.]

Date: 2009-10-15.00:00:00

Proposed resolution (October, 2009):

Change 11.4.5 [class.ctor] paragraph 5, the second list, as follows:

An implicitly-declared default constructor for class X is defined as deleted if:

  • X is a union-like class that has a variant member with a non-trivial default constructor,

  • any non-static data member with no brace-or-equal-initializer is of reference type,

  • any 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, or

  • any direct or virtual base class, or non-static data member with no brace-or-qual-initializer, or direct or virtual base class has class type M (or array thereof) and either M has no default constructor, or if constructor or overload resolution (12.2 [over.match]) as applied to M's default constructor, results in an ambiguity or in a function that is deleted or inaccessible from the implicitly-declared default constructor.

Date: 2009-07-01.00:00:00

(From message 14555.)

The reasons for which an implicitly-declared default constructor is defined as deleted, given in 11.4.5 [class.ctor] paragraph 4, all deal with cases in which a member cannot be default-initialized. Presumably a brace-or-equal-initializer for such a member would eliminate the need to define the constructor as deleted, but this case is not addressed by the current wording.

History
Date User Action Args
2010-03-29 00:00:00adminsetmessages: + msg2718
2010-03-29 00:00:00adminsetstatus: ready -> cd2
2009-11-08 00:00:00adminsetmessages: + msg2365
2009-11-08 00:00:00adminsetstatus: open -> ready
2009-07-01 00:00:00admincreate