aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm28@cam.ac.uk>2002-01-31 01:01:02 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2002-01-31 01:01:02 +0000
commit6169e5fdd8376fbbe0f66de366354fcfaf78b8a7 (patch)
tree88534a3810db907c206b3f773ecae87f4368c065 /gcc/c-decl.c
parent250fce1dfa15e987e9763b20398707490d8fd669 (diff)
downloadgcc-6169e5fdd8376fbbe0f66de366354fcfaf78b8a7.zip
gcc-6169e5fdd8376fbbe0f66de366354fcfaf78b8a7.tar.gz
gcc-6169e5fdd8376fbbe0f66de366354fcfaf78b8a7.tar.bz2
c-decl.c (grokdeclarator): Handle type being a typedef for an invalid type.
* c-decl.c (grokdeclarator): Handle type being a typedef for an invalid type. testsuite: * gcc.dg/noncompile/20020130-1.c: New test. From-SVN: r49352
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index ad23809..9deb193 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -4241,9 +4241,14 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, width)
/* Actual typedefs come to us as TYPE_DECL nodes. */
else if (TREE_CODE (id) == TYPE_DECL)
{
- type = TREE_TYPE (id);
- decl_attr = DECL_ATTRIBUTES (id);
- typedef_decl = id;
+ if (TREE_TYPE (id) == error_mark_node)
+ ; /* Allow the type to default to int to avoid cascading errors. */
+ else
+ {
+ type = TREE_TYPE (id);
+ decl_attr = DECL_ATTRIBUTES (id);
+ typedef_decl = id;
+ }
}
/* Built-in types come as identifiers. */
else if (TREE_CODE (id) == IDENTIFIER_NODE)