This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


1888. Implicitly-declared default constructors and explicit

Section: 11.4.5  [class.ctor]     Status: CD4     Submitter: Daniel Krügler     Date: 2014-03-04

[Moved to DR at the May, 2015 meeting.]

It used to be clear that an implicitly-declared default constructor is not explicit. That has been inadvertently lost due to other changes, so this specification should be added to 11.4.5 [class.ctor] in parallel with the similar statement in 11.4.5.3 [class.copy.ctor] paragraph 3.

Proposed resolution (November, 2014):

  1. Change 11.4.5 [class.ctor] paragraph 4 as follows:

  2. A default constructor for a class X is a constructor of class X that can be called without an argument. If there is no user-declared constructor for class X, a non-explicit constructor having no parameters is implicitly declared as defaulted (9.5 [dcl.fct.def]). An implicitly-declared default constructor...
  3. Change 11.4.8.2 [class.conv.ctor] paragraph 3 as follows:

  4. A non-explicit copy/move constructor (11.4.5.3 [class.copy.ctor]) is a converting constructor. [Note: An implicitly-declared copy/move constructor is not an explicit constructor; it may be called for implicit type conversions. end note]
  5. Change 11.4.5.3 [class.copy.ctor] paragraph 7 as follows:

  6. If the class definition does not explicitly declare a copy constructor, a non-explicit one is declared implicitly. If the class...
  7. Change 11.4.5.3 [class.copy.ctor] paragraph 9 as follows:

  8. If the definition of a class X does not explicitly declare a move constructor, a non-explicit one will be implicitly declared as defaulted if and only if...