|
52 | 52 |
|
53 | 53 | \begin{bnf} |
54 | 54 | \nontermdef{class-property-specifier}\br |
55 | | - \keyword{final}\br |
56 | | - \keyword{trivially_relocatable_if_eligible}\br |
57 | | - \keyword{replaceable_if_eligible} |
| 55 | + \keyword{final} |
58 | 56 | \end{bnf} |
59 | 57 |
|
60 | 58 | \begin{bnf} |
|
131 | 129 | within a single \grammarterm{class-property-specifier-seq}. |
132 | 130 | Whenever a \grammarterm{class-key} is followed |
133 | 131 | by a \grammarterm{class-head-name}, |
134 | | -one of the identifiers \tcode{final}, \tcode{trivially_relocatable_if_eligible}, |
135 | | -or \tcode{replaceable_if_eligible}, and a colon or left brace, |
| 132 | +the identifier \tcode{final}, and a colon or left brace, |
136 | 133 | the identifier is interpreted as a \grammarterm{class-property-specifier}. |
137 | 134 | \begin{example} |
138 | 135 | \begin{codeblock} |
|
142 | 139 |
|
143 | 140 | struct X { |
144 | 141 | struct C { constexpr operator int() { return 5; } }; |
145 | | - struct B trivially_relocatable_if_eligible : C{}; |
146 | | - // OK, definition of nested class \tcode{B}, |
147 | | - // not declaration of a bit-field member |
148 | | - // \tcode{trivially_relocatable_if_eligible} |
| 142 | + struct B final : C{}; // OK, definition of nested class \tcode{B}, |
| 143 | + // not declaration of a bit-field member \tcode{final} |
149 | 144 | }; |
150 | 145 | \end{codeblock} |
151 | 146 | \end{example} |
|
187 | 182 | \item that has a trivial, non-deleted destructor\iref{class.dtor}. |
188 | 183 | \end{itemize} |
189 | 184 |
|
190 | | -\pnum |
191 | | -A class \tcode{C} is \defn{default-movable} if |
192 | | - |
193 | | -\begin{itemize} |
194 | | -\item overload resolution for direct-initializing an object of type \tcode{C} |
195 | | -from an xvalue of type \tcode{C} selects a constructor that is a direct member |
196 | | -of \tcode{C} and is neither user-provided nor deleted, |
197 | | - |
198 | | -\item overload resolution for assigning to an lvalue of type \tcode{C} from an |
199 | | -xvalue of type \tcode{C} selects an assignment operator function that is a |
200 | | -direct member of \tcode{C} and is neither user-provided nor deleted, and |
201 | | - |
202 | | -\item \tcode{C} has a destructor that is neither user-provided nor deleted. |
203 | | -\end{itemize} |
204 | | - |
205 | | -\pnum |
206 | | -A class is \defn{eligible for trivial relocation} unless it |
207 | | -\begin{itemize} |
208 | | -\item has any virtual base classes, |
209 | | -\item has a base class that is not a trivially relocatable class, |
210 | | -\item has a non-static data member of an object type that is not of a |
211 | | -trivially relocatable type, or |
212 | | - |
213 | | -\item has a deleted destructor, |
214 | | -\end{itemize} |
215 | | -except that it is \impldef{whether an otherwise-eligible union having one or |
216 | | -more subobjects of polymorphic class type is eligible for trivial relocation} |
217 | | -whether an otherwise-eligible union having one or more subobjects of |
218 | | -polymorphic class type is eligible for trivial relocation. |
219 | | - |
220 | | -\pnum |
221 | | -A class \tcode{C} is a \defnadj{trivially relocatable}{class} |
222 | | -if it is eligible for trivial relocation and |
223 | | -\begin{itemize} |
224 | | -\item has the \tcode{trivially_relocatable_if_eligible} \grammarterm{class-property-specifier}, |
225 | | -\item is a union with no user-declared special member functions, or |
226 | | -\item is default-movable. |
227 | | -\end{itemize} |
228 | | - |
229 | | -\pnum |
230 | | -\begin{note} |
231 | | -A class with const-qualified or reference non-static data members can be |
232 | | -trivially relocatable. |
233 | | -\end{note} |
234 | | - |
235 | | -\pnum |
236 | | -A class \tcode{C} is \defn{eligible for replacement} unless |
237 | | -\begin{itemize} |
238 | | -\item it has a base class that is not a replaceable class, |
239 | | -\item it has a non-static data member that is not of a replaceable type, |
240 | | -\item overload resolution fails or selects a deleted constructor when |
241 | | -direct-initializing an object of type \tcode{C} from an xvalue of type |
242 | | -\tcode{C}\iref{dcl.init.general}, |
243 | | - |
244 | | -\item overload resolution fails or selects a deleted assignment operator |
245 | | -function when assigning to an lvalue of type \tcode{C} from an xvalue of type |
246 | | -\tcode{C}\iref{expr.assign,over.assign}, or |
247 | | - |
248 | | -\item it has a deleted destructor. |
249 | | -\end{itemize} |
250 | | - |
251 | | -\indextext{replaceable!class|see{class, replaceable}}% |
252 | | -\pnum |
253 | | -A class \tcode{C} is a \defnx{replaceable class}{class!replaceable} if it is |
254 | | -eligible for replacement and |
255 | | -\begin{itemize} |
256 | | -\item has the \tcode{replaceable_if_eligible} \grammarterm{class-property-specifier}, |
257 | | -\item is a union with no user-declared special member functions, or |
258 | | -\item is default-movable. |
259 | | -\end{itemize} |
260 | | - |
261 | | -\pnum |
262 | | -\begin{note} |
263 | | -Accessibility of the special member functions is not considered when |
264 | | -establishing trivial relocatability or replaceability. |
265 | | -\end{note} |
266 | | - |
267 | | -\pnum |
268 | | -\begin{note} |
269 | | -Not all trivially copyable classes are trivially relocatable or replaceable. |
270 | | -\end{note} |
271 | | - |
272 | 185 | \pnum |
273 | 186 | A class \tcode{S} is a \defnadj{standard-layout}{class} if it: |
274 | 187 | \begin{itemize} |
|
0 commit comments