This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Anonymous structs with duplicate members within unions


Dave Korn wrote:
-----Original Message-----
From: gcc-owner On Behalf Of Mark Mitchell
Sent: 19 January 2005 00:33


Steven L. Zook wrote:

"As such, they are ambiguous."

That seems a little harsh :-(

No; uDerf::A is ambiguous. Which one is it? You seem to be seeing that you want the A in the two anonymous structs to be merged together.


  In C, that's what the 'union' kind of implies, isn't it?  In the presence of
"common initial sequences" ?

No, that's a separate issue regarding type compatibility. The issue here is simply that you can't have two data members named uDerf::A. If the structs were not anonymous, then there would be no problem. C++ has special handling for anonymous unions; G++ has extended that to anonymous structs. In both case, things declared in the anonymous objects are (for naming purposes) declared in the containing object.


--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]