[cfe-dev] [PATCH] Allow unnamed structure or union fields within structs/unions in gnu99 mode

Pierre d'Herbemont pdherbemont at free.fr
Sun Nov 9 08:53:49 PST 2008


Hi,

This patch enables unnamed structure or union fields withing structs/ 
unions when -std=gnu99 is used. Cf [1].

Note, as stated in [1], struct { int a; union { int a; } } is  
discouraged, but won't produce any error nor warning.
It is unclear for me that we really want to add anonymous structure  
support in RecordDecl::getMember, as implementation could vary given  
the language standard. Yet, not implementing here could lead to easy  
and unoticeable mistakes if the caller doesn't implement anonymous  
structure resolving.

I'll be happy to ear your thoughts...

Pierre.

[1] http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Unnamed-Fields.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AllowUnnamedStructOrUnionInStructOrUnion.patch
Type: application/octet-stream
Size: 4001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20081109/ebba6e80/attachment.obj>
-------------- next part --------------



More information about the cfe-dev mailing list