Created on 2002-05-31.00:00:00 last changed 203 months ago
Note (March, 2008):
The Evolution Working Group recommended closing this issue with no further consideration. See paper J16/07-0033 = WG21 N2173.
Notes from October 2002 meeting:
There was agreement that the standard says such declarations are invalid; therefore this must be considered as an extension. There was general feeling that this extension would not be too useful, though Jason Merrill was sympathetic to the argument. It was also agreed that if this were to be changed it would require careful wording so as not to allow too many cases.
Is this legal? Should it be?
struct E { union { struct { int x; } s; } v; };
One compiler faults a type definition (i.e. of the anonymous struct) since it is in an anonymous union [11.5 [class.union] paragraph 2: "The member-specification of an anonymous union shall only define non-static data members."].
I would suggest that compiler B is correctly interpreting the standard but that this is a defect in the standard. There is no reason to disallow definition of anonymous structs.
Furthermore, is it really necessary to disallow definition of named types in anonymous unions in general, as long as the types do not need fully qualified names for external linkage? Why should this be illegal?
struct E { union { typedef int Int; struct X { X *next; Int n; } list; } v; };
History | |||
---|---|---|---|
Date | User | Action | Args |
2008-03-17 00:00:00 | admin | set | messages: + msg1635 |
2008-03-17 00:00:00 | admin | set | status: extension -> nad |
2002-11-08 00:00:00 | admin | set | messages: + msg797 |
2002-11-08 00:00:00 | admin | set | status: open -> extension |
2002-05-31 00:00:00 | admin | create |