diff options
author | Jakub Jelinek <jakub@redhat.com> | 2002-06-10 23:52:43 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2002-06-10 23:52:43 +0200 |
commit | 85d490584b173dd86e67af37a277a6b5fe823422 (patch) | |
tree | e96c6ba2da0a81abca5e5d61581b7a0628b3c73a /gcc/c-decl.c | |
parent | 50f30e6b07fbc68fefb6ecf1e585f8087c21715d (diff) | |
download | gcc-85d490584b173dd86e67af37a277a6b5fe823422.zip gcc-85d490584b173dd86e67af37a277a6b5fe823422.tar.gz gcc-85d490584b173dd86e67af37a277a6b5fe823422.tar.bz2 |
re PR c/6660 (Typedeffed unnamed structs/unions do not compile with gcc-3.1)
PR c/6660
* c-decl.c (grokfield): Allow user defined types if they declare
structs or unions for unnamed fields.
* gcc.dg/20020527-1.c: New test.
From-SVN: r54466
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 819e26e..075ac6d 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5361,8 +5361,11 @@ grokfield (filename, line, declarator, declspecs, width) { /* This is an unnamed decl. We only support unnamed structs/unions, so check for other things and refuse them. */ - if (TREE_CODE (TREE_VALUE (declspecs)) != RECORD_TYPE - && TREE_CODE (TREE_VALUE (declspecs)) != UNION_TYPE) + tree type = TREE_VALUE (declspecs); + + if (TREE_CODE (type) == TYPE_DECL) + type = TREE_TYPE (type); + if (TREE_CODE (type) != RECORD_TYPE && TREE_CODE (type) != UNION_TYPE) { error ("unnamed fields of type other than struct or union are not allowed"); return NULL_TREE; |