From Jason Turner

[class.copy.ctor]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp5kis0cy3/{from.md → to.md} +12 -14
tmp/tmp5kis0cy3/{from.md → to.md} RENAMED
@@ -123,11 +123,11 @@ form
123
  X::X(const X&)
124
  ```
125
 
126
  if each potentially constructed subobject of a class type `M` (or array
127
  thereof) has a copy constructor whose first parameter is of type `const`
128
- `M&` or `const` `volatile` `M&`.[^3]
129
 
130
  Otherwise, the implicitly-declared copy constructor will have the form
131
 
132
  ``` cpp
133
  X::X(X&)
@@ -155,29 +155,28 @@ X::X(X&&)
155
 
156
  An implicitly-declared copy/move constructor is an inline public member
157
  of its class. A defaulted copy/move constructor for a class `X` is
158
  defined as deleted [[dcl.fct.def.delete]] if `X` has:
159
 
160
- - a potentially constructed subobject of type `M` (or array thereof)
161
- that cannot be copied/moved because overload resolution
162
  [[over.match]], as applied to find `M`’s corresponding constructor,
163
- results in an ambiguity or a function that is deleted or inaccessible
164
- from the defaulted constructor,
165
- - a variant member whose corresponding constructor as selected by
166
- overload resolution is non-trivial,
167
- - any potentially constructed subobject of a type with a destructor that
168
- is deleted or inaccessible from the defaulted constructor, or,
169
  - for the copy constructor, a non-static data member of rvalue reference
170
  type.
171
 
172
  [*Note 4*: A defaulted move constructor that is defined as deleted is
173
  ignored by overload resolution [[over.match]], [[over.over]]. Such a
174
  constructor would otherwise interfere with initialization from an rvalue
175
  which can use the copy constructor instead. — *end note*]
176
 
177
  A copy/move constructor for class `X` is trivial if it is not
178
- user-provided and if:
179
 
180
  - class `X` has no virtual functions [[class.virtual]] and no virtual
181
  base classes [[class.mi]], and
182
  - the constructor selected to copy/move each direct base class subobject
183
  is trivial, and
@@ -189,13 +188,12 @@ otherwise the copy/move constructor is *non-trivial*.
189
 
190
  [*Note 5*: The copy/move constructor is implicitly defined even if the
191
  implementation elided its odr-use
192
  [[term.odr.use]], [[class.temporary]]. — *end note*]
193
 
194
- If an implicitly-defined [[dcl.fct.def.default]] constructor would be
195
- constexpr-suitable [[dcl.constexpr]], the implicitly-defined constructor
196
- is `constexpr`.
197
 
198
  Before the defaulted copy/move constructor for a class is implicitly
199
  defined, all non-user-provided copy/move constructors for its
200
  potentially constructed subobjects are implicitly defined.
201
 
@@ -204,11 +202,11 @@ exception specification [[except.spec]]. — *end note*]
204
 
205
  The implicitly-defined copy/move constructor for a non-union class `X`
206
  performs a memberwise copy/move of its bases and members.
207
 
208
  [*Note 7*: Default member initializers of non-static data members are
209
- ignored. See also the example in  [[class.base.init]]. — *end note*]
210
 
211
  The order of initialization is the same as the order of initialization
212
  of bases and members in a user-defined constructor (see 
213
  [[class.base.init]]). Let `x` be either the parameter of the constructor
214
  or, for the move constructor, an xvalue referring to the parameter. Each
 
123
  X::X(const X&)
124
  ```
125
 
126
  if each potentially constructed subobject of a class type `M` (or array
127
  thereof) has a copy constructor whose first parameter is of type `const`
128
+ `M&` or `const` `volatile` `M&`.[^2]
129
 
130
  Otherwise, the implicitly-declared copy constructor will have the form
131
 
132
  ``` cpp
133
  X::X(X&)
 
155
 
156
  An implicitly-declared copy/move constructor is an inline public member
157
  of its class. A defaulted copy/move constructor for a class `X` is
158
  defined as deleted [[dcl.fct.def.delete]] if `X` has:
159
 
160
+ - a potentially constructed subobject of type `M` (or possibly
161
+ multidimensional array thereof) for which overload resolution
162
  [[over.match]], as applied to find `M`’s corresponding constructor,
163
+ either does not result in a usable candidate [[over.match.general]]
164
+ or, in the case of a variant member, selects a non-trivial function,
165
+ - any potentially constructed subobject of class type `M` (or possibly
166
+ multidimensional array thereof) where `M` has a destructor that is
167
+ deleted or inaccessible from the defaulted constructor, or,
 
168
  - for the copy constructor, a non-static data member of rvalue reference
169
  type.
170
 
171
  [*Note 4*: A defaulted move constructor that is defined as deleted is
172
  ignored by overload resolution [[over.match]], [[over.over]]. Such a
173
  constructor would otherwise interfere with initialization from an rvalue
174
  which can use the copy constructor instead. — *end note*]
175
 
176
  A copy/move constructor for class `X` is trivial if it is not
177
+ user-provided and if
178
 
179
  - class `X` has no virtual functions [[class.virtual]] and no virtual
180
  base classes [[class.mi]], and
181
  - the constructor selected to copy/move each direct base class subobject
182
  is trivial, and
 
188
 
189
  [*Note 5*: The copy/move constructor is implicitly defined even if the
190
  implementation elided its odr-use
191
  [[term.odr.use]], [[class.temporary]]. — *end note*]
192
 
193
+ The implicitly-defined [[dcl.fct.def.default]] constructor is
194
+ `constexpr`.
 
195
 
196
  Before the defaulted copy/move constructor for a class is implicitly
197
  defined, all non-user-provided copy/move constructors for its
198
  potentially constructed subobjects are implicitly defined.
199
 
 
202
 
203
  The implicitly-defined copy/move constructor for a non-union class `X`
204
  performs a memberwise copy/move of its bases and members.
205
 
206
  [*Note 7*: Default member initializers of non-static data members are
207
+ ignored. — *end note*]
208
 
209
  The order of initialization is the same as the order of initialization
210
  of bases and members in a user-defined constructor (see 
211
  [[class.base.init]]). Let `x` be either the parameter of the constructor
212
  or, for the move constructor, an xvalue referring to the parameter. Each