re PR c/17023 (ICE with nested functions in parameter declaration)
authorRichard Henderson <rth@redhat.com>
Thu, 14 Oct 2004 23:20:58 +0000 (16:20 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 14 Oct 2004 23:20:58 +0000 (16:20 -0700)
        PR c/17023
        * c-decl.c (store_parm_decls_oldstyle): Care for parameter type
        as error_mark_node.
        * c-parse.in (compstmt_primary_start): Check cur_stmt_list non-null
        instaed of current_function_decl non-null.

From-SVN: r89063

gcc/ChangeLog
gcc/c-decl.c
gcc/c-parse.in
gcc/testsuite/gcc.dg/20041014-1.c [new file with mode: 0644]

index 55ba888699433dee631095430a1a7f175d84381f..6be32d736490deeed1b63083b190560715dffba0 100644 (file)
@@ -1,3 +1,11 @@
+2004-10-14  Richard Henderson  <rth@redhat.com>
+
+       PR c/17023
+       * c-decl.c (store_parm_decls_oldstyle): Care for parameter type
+       as error_mark_node.
+       * c-parse.in (compstmt_primary_start): Check cur_stmt_list non-null
+       instaed of current_function_decl non-null.
+
 2004-10-14  Matt Austern  <austern@apple.com>
 
        * pointer-set.c: New file, special-purpose hash table.
index 30a154cd9961cd1f228bcd590e5260a25d861924..9e9813d7f78416f014330aec087906438c25b95a 100644 (file)
@@ -6002,7 +6002,8 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
       if (TREE_CODE (parm) != PARM_DECL)
        continue;
 
-      if (!COMPLETE_TYPE_P (TREE_TYPE (parm)))
+      if (TREE_TYPE (parm) != error_mark_node
+         && !COMPLETE_TYPE_P (TREE_TYPE (parm)))
        {
          error ("%Jparameter %qD has incomplete type", parm, parm);
          TREE_TYPE (parm) = error_mark_node;
index 7542c3959fbffa306d0f001ae2597635ccdd388b..289e7c101af4090b6510e01fefc5d6298260eae7 100644 (file)
@@ -2033,7 +2033,7 @@ compstmt_contents_nonempty:
 
 compstmt_primary_start:
        '(' '{'
-               { if (current_function_decl == 0)
+               { if (cur_stmt_list == NULL)
                    {
                      error ("braced-group within expression allowed "
                             "only inside a function");
diff --git a/gcc/testsuite/gcc.dg/20041014-1.c b/gcc/testsuite/gcc.dg/20041014-1.c
new file mode 100644 (file)
index 0000000..6998440
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR c/17023 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void
+f(a, b)
+     int a;
+     int b[({ void h() {} 1; })];      /* { dg-error "braced-group" } */
+{
+}