re PR c++/27398 (ICE on missing closing parenthesis)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Sun, 21 May 2006 08:39:14 +0000 (08:39 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Sun, 21 May 2006 08:39:14 +0000 (08:39 +0000)
PR c++/27398
* decl.c (grokdeclarator): Return error_mark_node instead of NULL_TREE
or void_type_node.

* g++.dg/template/crash50.C: New test.

From-SVN: r113950

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/crash50.C [new file with mode: 0644]

index 9720952fca0d47623dd10e535ee620b45f308afd..13f25f0f3514f8086d16dcfea74ddb412edf2ee2 100644 (file)
@@ -1,3 +1,9 @@
+2006-05-21  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/27398
+       * decl.c (grokdeclarator): Return error_mark_node instead of NULL_TREE
+       or void_type_node.
+
 2006-05-19  Mike Stump  <mrs@apple.com>
 
        * typeck.c (default_conversion): Remove static.
index 1b5e41d373c7c56098fd04b4bc58e44d575cef86..72727dbca3c41d9be00646d40709d7efc39912de 100644 (file)
@@ -7285,7 +7285,7 @@ grokdeclarator (const cp_declarator *declarator,
   if (dependent_name && !friendp)
     {
       error ("%<%T::%D%> is not a valid declarator", ctype, dependent_name);
-      return void_type_node;
+      return error_mark_node;
     }
 
   /* Issue errors about use of storage classes for parameters.  */
@@ -7529,7 +7529,7 @@ grokdeclarator (const cp_declarator *declarator,
                    && !member_function_or_else (ctype,
                                                 current_class_type,
                                                 flags))
-                 return void_type_node;
+                 return error_mark_node;
 
                if (flags != DTOR_FLAG)
                  {
@@ -7543,7 +7543,7 @@ grokdeclarator (const cp_declarator *declarator,
                      }
                    if (decl_context == FIELD
                        && sfk != sfk_constructor)
-                     return NULL_TREE;
+                     return error_mark_node;
                  }
                if (decl_context == FIELD)
                  staticp = 0;
@@ -8148,7 +8148,7 @@ grokdeclarator (const cp_declarator *declarator,
                  {
                    error ("can't make %qD into a method -- not in a class",
                           unqualified_id);
-                   return void_type_node;
+                   return error_mark_node;
                  }
 
                /* ``A union may [ ... ] not [ have ] virtual functions.''
@@ -8157,7 +8157,7 @@ grokdeclarator (const cp_declarator *declarator,
                  {
                    error ("function %qD declared virtual inside a union",
                           unqualified_id);
-                   return void_type_node;
+                   return error_mark_node;
                  }
 
                if (NEW_DELETE_OPNAME_P (unqualified_id))
@@ -8259,7 +8259,7 @@ grokdeclarator (const cp_declarator *declarator,
                               funcdef_flag, template_count, in_namespace,
                               attrlist);
            if (decl == NULL_TREE)
-             return NULL_TREE;
+             return error_mark_node;
          }
        else if (!staticp && !dependent_type_p (type)
                 && !COMPLETE_TYPE_P (complete_type (type))
@@ -8316,7 +8316,7 @@ grokdeclarator (const cp_declarator *declarator,
                return decl;
              }
            else
-             return void_type_node;
+             return error_mark_node;
          }
 
        /* Structure field.  It may not be a function, except for C++.  */
@@ -8355,7 +8355,7 @@ grokdeclarator (const cp_declarator *declarator,
                     void_type_node, as if this was a friend
                     declaration, to cause callers to completely
                     ignore this declaration.  */
-                 return void_type_node;
+                 return error_mark_node;
              }
 
            if (staticp)
@@ -8403,7 +8403,7 @@ grokdeclarator (const cp_declarator *declarator,
        int publicp = 0;
 
        if (!unqualified_id)
-         return NULL_TREE;
+         return error_mark_node;
 
        if (TREE_CODE (unqualified_id) == TEMPLATE_ID_EXPR)
          original_name = dname;
@@ -8458,7 +8458,7 @@ grokdeclarator (const cp_declarator *declarator,
                           publicp, inlinep, sfk, funcdef_flag,
                           template_count, in_namespace, attrlist);
        if (decl == NULL_TREE)
-         return NULL_TREE;
+         return error_mark_node;
 
        if (staticp == 1)
          {
index d1441069635151247b462ecde99e2bc402a16802..737e18076e11161ebda9c5b44541340ba1dcd8a8 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-21  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/27398
+       * g++.dg/template/crash50.C: New test.
+
 2006-05-21  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/25746
diff --git a/gcc/testsuite/g++.dg/template/crash50.C b/gcc/testsuite/g++.dg/template/crash50.C
new file mode 100644 (file)
index 0000000..0060561
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/27398
+// { dg-do compile }
+
+struct A
+{
+  template<int> void* foo(; // { dg-error "primary-expression|initialization|static" }
+};