You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -288,38 +292,49 @@ Add a new term after we define what an aggregate and the elements of an aggregat
288
292
::: addu
289
293
[*]{.pnum} The _designatable members_ of an aggregate `T` are:
290
294
291
-
* [*.1]{.pnum} For each direct base class`C` of `T` that is an aggregate class, the designatable members of `C` for which lookup for that member in `T` finds the member of `C`,
292
-
*[*.2]{.pnum} The ordered *identifiers* in the direct non-static members of `T`.
295
+
* [*.1]{.pnum} For each direct base class`C` of `T` that is an aggregate class, in order they appear in the `$base-specifier-list$`, the designatable members of `C` for which lookup for that member in `T` finds the member of `C`, followed by
296
+
*[*.2]{.pnum} the direct non-static data members of `T`, in declaration order.
293
297
:::
294
298
:::
295
299
296
300
Extend [dcl.init.aggr]{.sref}/3.1:
297
301
298
302
::: std
299
-
[3.1]{.pnum} If the initializer list is a brace-enclosed *designated-initializer-list*, the aggregate shall be of classtype[, the identifier in each designator shall name a direct non-static data member of the class, and the explicitly initialized elements of the aggregate are the elements that are, or contain, those members.]{.rm} [`C` .]{.addu}
303
+
[3.1]{.pnum} If the initializer list is a brace-enclosed `$designated-initializer-list$`, the aggregate shall be of classtype[, the identifier in each designator shall name a direct non-static data member of the class, and the explicitly initialized elements of the aggregate are the elements that are, or contain, those members.]{.rm} [`C`.]{.addu}
304
+
305
+
::: addu
306
+
The explicitly initialized elements of `$C$` are:
307
+
308
+
*[3.1.1]{.pnum} For each `$braced-init-list$` in the `$designated-initializer-list$`, the base class subobject of `$C$` which the `$braced-init-list$` appertains to (see below), and
309
+
*[3.1.2]{.pnum} for each `$identifier$` in the `$designated-initializer-list$`, the designatable member of `$C$` named by, or containing (in the case of an anonymous union or a base class), that `$identifier$`.
310
+
:::
311
+
312
+
In either case, if there is either no such base class subobject or no such designatable member, the program is ill-formed.
313
+
314
+
old wording here:
300
315
301
316
::: addu
302
-
*[3.1.1]{.pnum} If the initializer list contains a `$initializer-list$`, then each `$initializer-clause$`in the `$initializer-list$` shall appertain (see below) to a base class subobject of `C` and the `$identifier$` in each `$designator$` shall name a direct non-static data member of `C`, and the explicitly initialized elements of the aggregate are those base class subobjects and direct members.
317
+
*[3.1.1]{.pnum} Each `$braced-init-list$`in the `$designated-initializer-list$` shall appertain (see below) to a base class subobject of `C` and the `$identifier$` in each `$designator$` shall name a direct non-static data member of `C`. The explicitly initialized elements of the aggregate are those base class subobjects and direct members.
303
318
*[3.1.2]{.pnum} Otherwise, the `$identifier$` in each `$designator$` shall name a designatable member of the class. The explicitly initialized elements of the aggregate are the elements that are, or contain (in the case of an anonymous union or of a base class) those members.
304
319
:::
305
320
306
321
:::
307
322
308
-
And extend [dcl.init.aggr]{.sref}/4 to cover base class elements:
323
+
And extend [dcl.init.aggr]{.sref}/4 to cover base class elements (TODO: do we need this special case first bullet? Expand the designated-initializer-list bullet instead of adding a new bullet. Probably only need to change 4.2):
309
324
310
325
::: std
311
326
[4]{.pnum} For each explicitly initialized element:
312
327
313
328
::: addu
314
-
* [4.0]{.pnum} If the initializer list is a brace-enclosed *designated-initializer-list* with no `$initializer-list$` and the element is a direct base class, then let `C` denote that direct base class and let `T` denote the class. The element is initialized from a synthesized brace-enclosed *designated-initializer-list* containing each *designator* for which lookup in `T` names a direct or indirect non-static data member of `C` in the same order as in the original *designated-initializer-list*.
329
+
* [4.0]{.pnum} If the initializer list is a brace-enclosed `$designated-initializer-list$` with no `$braced-init-list$` and the element is a direct base class, then let `C` denote that direct base class and let `T` denote the class. The element is initialized from a synthesized brace-enclosed *designated-initializer-list* containing each *designator* for which lookup in `T` names a (direct or indirect) non-static data member of `C` in the same order as in the original *designated-initializer-list*.
[3.1]{.pnum} If the _braced-init-list_ contains a _designated-initializer-list_, `T` shall be an aggregate class.
370
-
The ordered *identifier*s in the designators of the *designated-initializer-list* shall form a subsequence of [designatable members [(dcl.init.aggr)] of `T`.]{.addu}
385
+
The ordered *identifier*s in the designators of the *designated-initializer-list* shall form a subsequence of [the ordered `$identifiers$` in the direct non-static data members]{.rm} [the designatable members [(dcl.init.aggr)] of `T`.]{.addu}
371
386
372
387
Aggregate initialization is performed ([dcl.init.aggr]).
373
388
@@ -423,7 +438,7 @@ Bump `__cpp_designated_initializers` in [cpp.predefined]{.sref}:
0 commit comments