Title
Definition of "user-declared" special member function
Status
open
Section
11.4.1 [class.mem.general]
Submitter
Arthur O'Dwyer

Created on 2026-01-12.00:00:00 last changed 1 week ago

Messages

Date: 2026-01-11.16:55:54

Possible resolution:

  1. Change in 9.10 [namespace.udecl] paragraph 4 as follows:

    If a constructor or assignment operator brought from a base class into a derived class has the signature of a copy/move constructor or assignment operator for the derived class (11.4.5.3 [class.copy.ctor], 11.4.6 [class.copy.assign]), the using-declaration does not by itself suppress the implicit declaration of the derived class member; the member from the base class is hidden or overridden by the implicitly-declared copy/move constructor or assignment operator of the derived class, as described below. [ Note: A using-declarator that names a member function of a base class does not suppress the implicit declaration of a special member function in the derived class, even if their signatures are the same (11.4.5.2 [class.default.ctor], 11.4.5.3 [class.copy.ctor], 11.4.6 [class.copy.assign]). -- end note ]
  2. Change in 11.4.1 [class.mem.general] paragraph 4 as follows:

    ... For any other member-declaration, each declared entity that is not an unnamed bit-field (11.4.10 [class.bit]) is a member of the class, and each such member-declaration shall either declare at least one member name of the class or declare at least one unnamed bit-field. A user-declared entity is a member or friend declared by a member-declaration.
  3. Change in 11.4.5.2 [class.default.ctor] paragraph 1 as follows:

    A default constructor for a class X is a constructor of class X for which each parameter that is not a function parameter pack has a default argument (including the case of a constructor with no parameters). If there is no a class does not have a user-declared constructor or constructor template for class X, a non-explicit constructor having no parameters is implicitly declared as defaulted (9.6 [dcl.fct.def]). An implicitly-declared default constructor is an inline public member of its class.
  4. Change in 11.4.5.3 [class.copy.ctor] paragraph 6 as follows:

    If the class definition does not explicitly declare have a user-declared copy constructor, a non-explicit one is declared implicitly. ...
  5. Change in 11.4.5.3 [class.copy.ctor] paragraph 8 as follows:

    If the definition of a class X does not explicitly declare have a user-declared move constructor, a non-explicit one will be implicitly declared as defaulted if and only if ...
  6. Add a new paragraph before 11.4.5.3 [class.copy.ctor] paragraph 11 as follows:

    [ Note: A using-declaration in a derived class C that names a constructor from a base class never suppresses the implicit declaration of a copy/move constructor of C, even if the base class constructor would be a copy or move constructor if declared as a member of C. -- end note]

    A copy/move constructor for class X is trivial if it is not user-provided and if: ...

  7. Change in 11.4.6 [class.copy.assign] paragraph 2 as follows:

    If the class definition does not explicitly declare have a user-declared copy assignment operator, one is declared implicitly. If the class definition declares has a user-declared move constructor or move assignment operator, the implicitly declared copy assignment operator is defined as deleted; otherwise, it is defaulted (9.6 [dcl.fct.def]). The latter case is deprecated if the class has a user-declared copy constructor or a user-declared destructor (D.6 [depr.impldec]). ...
Date: 2026-01-12.00:00:00

(Split off from issue 2799.)

The standard does not define what a "user-declared" special member function is.

History
Date User Action Args
2026-01-12 00:00:00admincreate
2026-01-11 08:11:16adminsetmessages: + msg8454