diff options
author | Joseph Myers <joseph@codesourcery.com> | 2011-03-18 21:16:31 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2011-03-18 21:16:31 +0000 |
commit | ff8e21599213bbea6ccacecf2522ad19836c8fd1 (patch) | |
tree | 080d7b0817fada736ec3b580f8573b09cf4c52d1 /gcc/c-decl.c | |
parent | 16cc44407fe40e3411e206eeec60a14d20769ade (diff) | |
download | gcc-ff8e21599213bbea6ccacecf2522ad19836c8fd1.zip gcc-ff8e21599213bbea6ccacecf2522ad19836c8fd1.tar.gz gcc-ff8e21599213bbea6ccacecf2522ad19836c8fd1.tar.bz2 |
c-decl.c (grokfield): Don't allow typedefs for structures or unions with no tag by default.
* c-decl.c (grokfield): Don't allow typedefs for structures or
unions with no tag by default.
* doc/extend.texi (Unnamed Fields): Update.
testsuite:
* gcc.dg/c1x-anon-struct-1.c: Don't test use of typedefs.
* gcc.dg/c1x-anon-struct-3.c: New test.
* gcc.dg/anon-struct-11.c: Update.
From-SVN: r171170
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index b438b06..8f9c444 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6674,11 +6674,14 @@ grokfield (location_t loc, || TREE_CODE (type) == UNION_TYPE); bool ok = false; - if (type_ok) + if (type_ok + && (flag_ms_extensions + || flag_plan9_extensions + || !declspecs->typedef_p)) { if (flag_ms_extensions || flag_plan9_extensions) ok = true; - else if (TYPE_NAME (TYPE_MAIN_VARIANT (type)) == NULL) + else if (TYPE_NAME (type) == NULL) ok = true; else ok = false; |