This is the mail archive of the gcc-patches@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 struct ambiguity detection (PR c/4784)


On Sun, May 9, 2010 at 9:21 AM, Joseph S. Myers <joseph@codesourcery.com> wrote:
> This patch fixes PR 4784, the failure of the C front end to diagnose
> duplicate fields where anonymous structures and unions are involved.
> This is part of implementing C1X requirements for anonymous structures
> and unions ("The members of an anonymous struct or union are
> considered to be members of the containing structure or union.",
> meaning they have the same scope and namespace as members of the
> containing type and so duplicates violate the constraint in 6.7#3 on
> duplicate declarations of an identifier with no linkage).
>
> Bootstrapped with no regressions on x86_64-unknown-linux-gnu. ?Applied
> to mainline.
>
> 2010-05-09 ?Joseph Myers ?<joseph@codesourcery.com>
>
> ? ? ? ?PR c/4784
> ? ? ? ?* c-decl.c (detect_field_duplicates_hash): New. ?Handle anonymous
> ? ? ? ?structures and unions recursively.
> ? ? ? ?(detect_field_duplicates): Move duplicate detection with a hash to
> ? ? ? ?detect_field_duplicates_hash. ?Always use a hash if anonymous
> ? ? ? ?structures or unions are present.
> ? ? ? ?* doc/extend.texi (Unnamed Fields): Document that duplicate fields
> ? ? ? ?give errors.
>
> testsuite:
> 2010-05-09 ?Joseph Myers ?<joseph@codesourcery.com>
>
> ? ? ? ?PR c/4784
> ? ? ? ?* gcc.dg/anon-struct-9.c: New test.
>

This test failed on Linux/ia32.


-- 
H.J.


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