In this declaration
 
B b = { 1, 2 };
 
there is initialized the object b of the aggregate B. The aggregate B has two elements: the direct base class A and the data member z.
 
According to the quote
 
(3.2) — If the initializer list is an initializer-list, the explicitly initialized elements of the aggregate are the first n elements of the aggregate, where n is the number of elements in the initializer list.
 
first two elements of the aggregate B are being  initialized. But this is not true. Only the single element that is the direct class A is initialized explicitly. So the quote  contradicts the realty.
 
With best regards
(Vlad from Moscow)
You can meet me at http://cpp.forum24.ru/ or www.stackoverflow.com or http://ru.stackoverflow.com
 
 
Суббота, 28 ноября 2020, 19:33 +03:00 от Jason McKesson via Std-Discussion <std-discussion@lists.isocpp.org>:
 
On Fri, Nov 27, 2020 at 2:07 PM Vladimir Grigoriev via Std-Discussion
<std-discussion@lists.isocpp.org> wrote:
>
> It seems there is a problem with the arithmetic relative to aggregates (C++ 20, 9.4.1 Aggregates)
>
> The elements of an aggregate are defined the following way
>
> 2 The elements of an aggregate are:
> (2.2) — for a class, the direct base classes in declaration order, followed by the direct non-static data members (11.4) that are not members of an anonymous union, in declaration order
>
> So for example if we have
>
> struct A
> {
> int x, y;
> };
>
> struct B : A
> {
> int z;
> };
>
> then according to the quote the aggregate B has only two elements: the direct base class A and the direct non-static data member z.
>
> Now consider the initialization of an object of the aggregate
>
> B b = { 1, 2 };
>
> and let’s read another quote from this section
>
> 3 When an aggregate is initialized by an initializer list as specified in 9.4.4, the elements of the initializer list are taken as initializers for the elements of the aggregate. The explicitly initialized elements of the aggregate are determined as follows:
> (3.2) — If the initializer list is an initializer-list, the explicitly initialized elements of the aggregate are the first n elements of the aggregate, where n is the number of elements in the initializer list.
>
> So according to the quote we have two explicitly initialized elements of the aggregate corresponding to the number of initializers when actually only one element of the aggregate, its direct base class, was initialized.

There are two aggregate types involved in this example. In which
circumstances is the text "the aggregate" referring `A` and to `B`?

Once you work that out, it makes sense.
--
Std-Discussion mailing list
Std-Discussion@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion