summaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-10 21:52:43 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-10 21:52:43 +0000
commit188fc74c700cec58eb6d341fd8802c6deff2dfca (patch)
treee96c6ba2da0a81abca5e5d61581b7a0628b3c73a /gcc/c-decl.c
parent6fff0335f84b4fbc80fe510b02694c2bb4c2d73b (diff)
downloadgcc-188fc74c700cec58eb6d341fd8802c6deff2dfca.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54466 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 819e26e9596..075ac6d0bb0 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;