Date: Sun, 2 Jun 2019 18:09:34 +0300
On Sun, 2 Jun 2019 at 17:34, Language Lawyer via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
> https://stackoverflow.com/a/32945791/9585016
In other words,
1) a is in scope per http://eel.is/c++draft/basic.scope.pdecl#1
2) a.x has been completely initialized per
http://eel.is/c++draft/dcl.init.aggr#6
The initialization is well-formed, legal, and does what you expect.
The earlier statements about designated initializers
do not apply, but if we choose to modify the example to use designated
initializers, it still works:
struct {
int x;
int y;
} a{.x = 42, .y = a.x};
<std-discussion_at_[hidden]> wrote:
>
> https://stackoverflow.com/a/32945791/9585016
In other words,
1) a is in scope per http://eel.is/c++draft/basic.scope.pdecl#1
2) a.x has been completely initialized per
http://eel.is/c++draft/dcl.init.aggr#6
The initialization is well-formed, legal, and does what you expect.
The earlier statements about designated initializers
do not apply, but if we choose to modify the example to use designated
initializers, it still works:
struct {
int x;
int y;
} a{.x = 42, .y = a.x};
Received on 2019-06-02 10:11:32