Created on 2012-11-16.00:00:00 last changed 121 months ago
[Moved to DR at the September, 2013 meeting.]
Proposed resolution (June, 2013):
Change 11.5 [class.union] paragraph 5 as follows:
...The member-specification of an anonymous union shall only define non-static data members. [Note: Nested types, anonymous unions, and functions cannot be declared within an anonymous union. —end note] The names of the members...
Additional note (March, 2013):
It is not clear whether this example violates 11.5 [class.union] paragraph 5:
The member-specification of an anonymous union shall only define non-static data members. [Note: Nested types and functions cannot be declared within an anonymous union. —end note]
Is a nested anonymous union a “non-static data member” or a “nested type?”
After the resolution of issue 1359, one of the requirements for constexpr constructors is:
if the class is a non-empty union, or for each non-empty anonymous union member of a non-union class, exactly one non-static data member shall be initialized;
This wording does not appear to handle nested anonymous unions. For example:
struct S { union { union { int x = 1; float f; }; void *p = nullptr; }; };
Clearly here both S::x and S::p are initialized, but that does not appear to violate the new constraint.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-11-24 00:00:00 | admin | set | status: drwp -> c++14 |
2014-03-03 00:00:00 | admin | set | status: dr -> drwp |
2013-10-14 00:00:00 | admin | set | messages: + msg4684 |
2013-10-14 00:00:00 | admin | set | status: tentatively ready -> dr |
2013-09-03 00:00:00 | admin | set | messages: + msg4455 |
2013-09-03 00:00:00 | admin | set | status: drafting -> tentatively ready |
2013-05-03 00:00:00 | admin | set | status: open -> drafting |
2013-03-18 00:00:00 | admin | set | messages: + msg4273 |
2012-11-16 00:00:00 | admin | create |