Skip to content

Commit 30b9804

Browse files
burblebeetkoeppe
authored andcommitted
CWG3148 Definition of "user-declared" special member function
Editorial note: * In new wording from previous CWG3130, which added a new reference to "X" in [class.default.ctor], change "X" to "the class", since the change from CWG3148 removes the name "X".
1 parent c25b52e commit 30b9804

2 files changed

Lines changed: 31 additions & 15 deletions

File tree

‎source/classes.tex‎

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,10 @@
580580
shall either
581581
declare at least one member name of the class
582582
or declare at least one unnamed bit-field.
583+
A \defnx{user-declared}{entity!user-declared}
584+
\indextext{user-declared entity|see{entity, user-declared}}
585+
entity is a direct member or a friend that, in either case,
586+
is declared by a \grammarterm{member-declaration}.
583587

584588
\pnum
585589
A \defn{data member} is either a non-function member introduced by a
@@ -1273,8 +1277,9 @@
12731277
has a default argument
12741278
(including the case of a constructor with no parameters).
12751279
\indextext{implicitly-declared default constructor}%
1276-
If there is no user-declared constructor or constructor template for class
1277-
\tcode{X} and \tcode{X} is not an anonymous union,
1280+
If a class does not have
1281+
a user-declared constructor or constructor template,
1282+
and the class is not an anonymous union,
12781283
a non-explicit constructor having no parameters is implicitly declared
12791284
as defaulted\iref{dcl.fct.def}.
12801285
An implicitly-declared default constructor is an
@@ -1503,7 +1508,7 @@
15031508
\end{example}
15041509

15051510
\pnum
1506-
If the class definition does not explicitly declare a copy constructor
1511+
If the class does not have a user-declared copy constructor
15071512
and the class is not an anonymous union,
15081513
a non-explicit one is declared \defnx{implicitly}{constructor!copy!implicitly declared}.
15091514
If the class definition declares a move
@@ -1544,8 +1549,8 @@
15441549

15451550
\pnum
15461551
\indextext{constructor!move!implicitly declared}%
1547-
If the definition of a class \tcode{X} does not explicitly declare
1548-
a move constructor, a non-explicit one will be
1552+
If a class \tcode{X} does not have
1553+
a user-declared move constructor, a non-explicit one will be
15491554
implicitly declared as defaulted if and only if
15501555
\begin{itemize}
15511556
\item
@@ -1605,6 +1610,17 @@
16051610
an rvalue which can use the copy constructor instead.
16061611
\end{note}
16071612

1613+
\pnum
1614+
\begin{note}
1615+
A using-declaration in a derived class \tcode{C} that
1616+
names a constructor from a base class
1617+
never suppresses the implicit declaration of
1618+
a copy/move constructor of \tcode{C},
1619+
even if the base class constructor would be
1620+
a copy or move constructor
1621+
if declared as a member of \tcode{C}.
1622+
\end{note}
1623+
16081624
\pnum
16091625
\indextext{constructor!copy!trivial}%
16101626
\indextext{constructor!move!trivial}%
@@ -1746,10 +1762,10 @@
17461762
\end{note}
17471763

17481764
\pnum
1749-
If the class definition does not explicitly declare a copy assignment operator
1765+
If the class does not have a user-declared copy assignment operator
17501766
and the class is not an anonymous union,
17511767
one is declared \defnx{implicitly}{assignment operator!copy!implicitly declared}.
1752-
If the class definition declares a move
1768+
If the class has a user-declared move
17531769
constructor or move assignment operator, the implicitly declared copy
17541770
assignment operator is defined as deleted; otherwise, it is
17551771
defaulted\iref{dcl.fct.def}.

‎source/declarations.tex‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8803,14 +8803,14 @@
88038803
\grammarterm{using-declaration} cannot refer to a
88048804
destructor for a base class.
88058805
\end{note}
8806-
If a constructor or assignment operator brought from a base class into a derived class
8807-
has the signature of a copy/move constructor or assignment operator
8808-
for the derived class\iref{class.copy.ctor,class.copy.assign},
8809-
the \grammarterm{using-declaration} does not by itself
8810-
suppress the implicit declaration of the derived class member;
8811-
the member from the base class is hidden or overridden
8812-
by the implicitly-declared copy/move constructor or assignment operator
8813-
of the derived class, as described below.
8806+
\begin{note}
8807+
A \grammarterm{using-declarator} that
8808+
names a member function of a base class
8809+
does not suppress the implicit declaration of a special member function
8810+
in the derived class,
8811+
even if their signatures are the
8812+
same\iref{class.default.ctor, class.copy.ctor, class.copy.assign}.
8813+
\end{note}
88148814

88158815
\pnum
88168816
A \grammarterm{using-declaration} shall not name a \grammarterm{template-id}.

0 commit comments

Comments
 (0)