Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 5 additions & 47 deletions source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,7 @@
The implementation will implicitly declare these member functions for some class
types when the program does not explicitly declare them.
The implementation will implicitly define them
if they are odr-used\iref{term.odr.use} or
needed for constant evaluation\iref{expr.const}.
as needed\iref{dcl.fct.def.default}.
\end{note}
An implicitly-declared special member function is declared at the closing
\tcode{\}} of the \grammarterm{class-specifier}.
Expand Down Expand Up @@ -1303,15 +1302,7 @@
\defnx{non-trivial}{constructor!default!non-trivial}.

\pnum
A default constructor
that is defaulted and not defined as deleted
is
\defnx{implicitly defined}{constructor!implicitly defined}
when it is odr-used\iref{term.odr.use}
to initialize an object of its class type\iref{intro.object},
when it is needed for constant evaluation\iref{expr.const}, or
when it is explicitly defaulted after its first declaration.
The implicitly-defined default constructor performs the set of
An implicitly-defined\iref{dcl.fct.def.default} default constructor performs the set of
initializations of the class that would be performed by a user-written default
constructor for that class with no
\grammarterm{ctor-initializer}\iref{class.base.init} and an empty
Expand Down Expand Up @@ -1602,20 +1593,11 @@
\defnx{non-trivial}{constructor!copy!nontrivial}.

\pnum
\indextext{constructor!copy!implicitly defined}%
\indextext{constructor!move!implicitly defined}%
A copy/move constructor
that is defaulted and not defined as deleted
is
\term{implicitly defined}
when it is odr-used\iref{term.odr.use},
when it is needed for constant evaluation\iref{expr.const}, or
when it is explicitly defaulted after its first declaration.
\begin{note}
The copy/move constructor is implicitly defined even if the implementation elided
its odr-use\iref{term.odr.use,class.temporary}.
\end{note}
If the implicitly-defined constructor would satisfy the requirements of a
If an implicitly-defined\iref{dcl.fct.def.default} constructor would satisfy the requirements of a
constexpr function\iref{dcl.constexpr}, the implicitly-defined
constructor is \keyword{constexpr}.

Expand Down Expand Up @@ -1905,18 +1887,7 @@
\defnx{non-trivial}{assignment operator!copy!non-trivial}.

\pnum
\indextext{assignment operator!copy!implicitly defined}%
\indextext{assignment operator!move!implicitly defined}%
A copy/move assignment operator for a class \tcode{X}
that is defaulted and not defined as deleted
is
\term{implicitly defined}
when it is odr-used\iref{term.odr.use}
(e.g., when it is selected by overload resolution
to assign to an object of its class type),
when it is needed for constant evaluation\iref{expr.const}, or
when it is explicitly defaulted after its first declaration.
The implicitly-defined copy/move assignment operator is \keyword{constexpr}.
An implicitly-defined\iref{dcl.fct.def.default} copy/move assignment operator is \keyword{constexpr}.

\pnum
Before the defaulted copy/move assignment operator for a class is
Expand Down Expand Up @@ -2126,14 +2097,6 @@
A defaulted destructor is a constexpr destructor
if it satisfies the requirements for a constexpr function\iref{dcl.constexpr}.

\pnum
A destructor
that is defaulted and not defined as deleted
is
\defnx{implicitly defined}{destructor!implicitly defined}
when it is odr-used\iref{term.odr.use}
or when it is explicitly defaulted after its first declaration.

\pnum
Before a
defaulted destructor for a class is implicitly defined, all the non-user-provided
Expand Down Expand Up @@ -6435,12 +6398,7 @@
where the implicit object parameter (if any) is considered to be
the first parameter.
\end{itemize}
A comparison operator function for class \tcode{C} that
is defaulted on its first declaration and
is not defined as deleted is
\defnx{implicitly defined}{operator!comparison!implicitly defined}
when it is odr-used or needed for constant evaluation.
Name lookups in the defaulted definition
Name lookups in the implicit definition\iref{dcl.fct.def.default}
of a comparison operator function
are performed from a context equivalent to
its \grammarterm{function-body}.
Expand Down
8 changes: 6 additions & 2 deletions source/declarations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6275,7 +6275,7 @@
Explicitly-defaulted functions and implicitly-declared functions are collectively
called \defn{defaulted} functions, and the implementation
shall provide implicit definitions
for them\iref{class.ctor,class.dtor,class.copy.ctor,class.copy.assign},
for them\iref{class.ctor,class.dtor,class.copy.ctor,class.copy.assign} as described below,
including possibly defining them as deleted.
A defaulted prospective destructor\iref{class.dtor}
that is not a destructor is defined as deleted.
Expand All @@ -6287,8 +6287,12 @@
\defn{user-provided} if it is user-declared and not explicitly
defaulted or deleted on its first declaration. A user-provided explicitly-defaulted function
(i.e., explicitly defaulted after its first declaration)
is defined at the point where it is explicitly defaulted; if such a function is implicitly
is implicitly defined at the point where it is explicitly defaulted; if such a function is implicitly
defined as deleted, the program is ill-formed.
A non-user-provided defaulted function
(i.e. implicitly declared or explicitly defaulted in the class)
that is not defined as deleted is implicitly defined when it is odr-used\iref{basic.def.odr}
or needed for constant evaluation\iref{expr.const}.
\begin{note}
Declaring a function as defaulted after its first declaration can provide
efficient execution and concise
Expand Down