Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dcl.init.aggr] p2 Elements of an anonymous union #4899

Open
xmh0511 opened this issue Sep 13, 2021 · 0 comments
Open

[dcl.init.aggr] p2 Elements of an anonymous union #4899

xmh0511 opened this issue Sep 13, 2021 · 0 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Sep 13, 2021

The elements of an aggregate are:

  • [...]
  • for a class, the direct base classes in declaration order, followed by the direct non-static data members ([class.mem]) that are not members of an anonymous union, in declaration order.
static union {
   int c;
};

The member c is an element of the anonymous union, I believe. Presumably, the intent of [dcl.init.aggr] p2 is to exclude the member of an anonymous union member of a class of which that member is a direct member. Should we say

for a class, the direct base classes in declaration order, followed by the direct non-static data members ([class.mem]) that are not members of an anonymous union member, in declaration order.

It could make that rule admit that a member of an anonymous union is an element of the anonymous union.

@xmh0511 xmh0511 changed the title [dcl.init.aggr] p2 Elements of aggregate [dcl.init.aggr] p2 Elements of anonymous union Sep 13, 2021
@xmh0511 xmh0511 changed the title [dcl.init.aggr] p2 Elements of anonymous union [dcl.init.aggr] p2 Elements of an anonymous union Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant