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
If the element is an anonymous union member and the initializer list is a brace-enclosed designated-initializer-list, the element is initialized by the designated-initializer-list { D }, where D is the designated-initializer-clause naming a member of the anonymous union member. There shall be only one such designated-initializer-clause.
How could designated-initializer-list be the form { D }? According to the grammar of designated-initializer-list, it should be the comma-separated list of .identifier brace-or-equal-initializer. The above rule seems to phrase the following example
structC{
union {
int a;
};
};
C c = {{.a = 0}};
In this example, the corresponding initializer of the anonymous union member is the initializer-clasuse, which is a brace-enclosed designated-initializer-list. However, the formal example under [dcl.init.aggr]/4.1 is that
structC {
union {
int a;
constchar* p;
};
int x;
} c = { .a = 1, .x = 3 };
That is, the original intent of the above rule is used to phrase the case where the explicitly initialized element is an anonymous union member and the corresponding initializer is a designated-initializer-clause naming the member of it. Should we reword the rule to that
If the element is an anonymous union member and the initializer D is a designated-initializer-clause naming a member of the anonymous union member, the element is initialized by the initializer { D }. There shall be only one such designated-initializer-clause for the anonymous union member.
The text was updated successfully, but these errors were encountered:
How could designated-initializer-list be the form
{ D }
? According to the grammar of designated-initializer-list, it should be the comma-separated list of .identifier brace-or-equal-initializer. The above rule seems to phrase the following exampleIn this example, the corresponding initializer of the anonymous union member is the
initializer-clasuse
, which is a brace-enclosed designated-initializer-list. However, the formal example under [dcl.init.aggr]/4.1 is thatThat is, the original intent of the above rule is used to phrase the case where the explicitly initialized element is an anonymous union member and the corresponding initializer is a designated-initializer-clause naming the member of it. Should we reword the rule to that
The text was updated successfully, but these errors were encountered: