[C++ Patch] PR 44625
Paolo Carlini
paolo.carlini@oracle.com
Thu Jun 23 16:13:00 GMT 2011
On 06/23/2011 06:05 PM, Jason Merrill wrote:
> Actually, 9.5 says
>
> A union of the form
> union { member-specification } ;
> is called an anonymous union; it defines an unnamed object of unnamed
> type. 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 ]
>
> So we should be able to just reject nested anonymous aggregates and
> not worry about how to make them work.
Yes, but we are accepting already some of that as an extension. If I
compile the testcase with -pedantic-errors I get:
44625.C:8:31: error: ISO C++ prohibits anonymous structs [-pedantic]
44625.C:9:9: error: anonymous struct not inside named type
thus, it's not clear to me where we should stop, exactly.
Paolo.
More information about the Gcc-patches
mailing list