decl.c (grokfndecl): Return NULL_TREE instead of error_mark_node.
authorJason Merrill <jason@yorick.cygnus.com>
Mon, 15 Feb 1999 23:45:02 +0000 (23:45 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 15 Feb 1999 23:45:02 +0000 (18:45 -0500)
* decl.c (grokfndecl): Return NULL_TREE instead of error_mark_node.
(grokdeclarator): Don't expect error_mark_node from grokfndecl.
* pt.c (maybe_process_partial_specialization): Complain about
'template <>' on non-specialization.

From-SVN: r25225

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/pt.c

index dd1612da1bcb63be418aacd594cca91cef58b8c7..8fb2e889d0eef41d11c21e5f42afa9acd8d3f559 100644 (file)
@@ -1,3 +1,11 @@
+1999-02-13  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * decl.c (grokfndecl): Return NULL_TREE instead of error_mark_node.
+       (grokdeclarator): Don't expect error_mark_node from grokfndecl.
+
+       * pt.c (maybe_process_partial_specialization): Complain about
+       'template <>' on non-specialization.
+
 1999-02-10  Jason Merrill  <jason@yorick.cygnus.com>
 
        * decl.c (grokdeclarator): Catch wierd declarators.
index 2547ddf17de33ee28777efe62a9d64e687953dba..24dbfd108ebdb4dcc327aacec7baefcd4c91e449 100644 (file)
@@ -8344,7 +8344,7 @@ bad_specifiers (object, type, virtualp, quals, inlinep, friendp, raises)
    CHECK is 1 if we must find this method in CTYPE, 0 if we should
    not look, and -1 if we should not call `grokclassfn' at all.  
 
-   Returns `error_mark_node' if something goes wrong, after issuing
+   Returns `NULL_TREE' if something goes wrong, after issuing
    applicable error messages.  */
 
 static tree
@@ -8496,7 +8496,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
              /* Something like `template <class T> friend void f<T>()'.  */
              cp_error ("template-id `%D' in declaration of primary template", 
                        orig_declarator);
-             return error_mark_node;
+             return NULL_TREE;
            }
 
          /* A friend declaration of the form friend void f<>().  Record
@@ -8544,7 +8544,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
                                            2 * (funcdef_flag != 0) + 
                                            4 * (friendp != 0));
       if (decl == error_mark_node)
-       return error_mark_node;
+       return NULL_TREE;
 
       if ((! TYPE_FOR_JAVA (ctype) || check_java_method (decl))
          && check)
@@ -8560,7 +8560,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
            return tmp;
        }
       if (! grok_ctor_properties (ctype, decl))
-       return error_mark_node;
+       return NULL_TREE;
     }
   else
     {
@@ -8577,7 +8577,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
                                            2 * (funcdef_flag != 0) + 
                                            4 * (friendp != 0));
       if (decl == error_mark_node)
-       return error_mark_node;
+       return NULL_TREE;
 
       if (ctype != NULL_TREE
          && (! TYPE_FOR_JAVA (ctype) || check_java_method (decl))
@@ -10931,7 +10931,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
                               virtualp, flags, quals, raises, attrlist,
                               friendp ? -1 : 0, friendp, publicp, inlinep,
                               funcdef_flag, template_count, in_namespace);
-           if (decl == NULL_TREE || decl == error_mark_node)
+           if (decl == NULL_TREE)
              return decl;
 #if 0
            /* This clobbers the attrs stored in `decl' from `attrlist'.  */
@@ -11178,11 +11178,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
        if (decl == NULL_TREE)
          return NULL_TREE;
 
-       /* Among other times, could occur from check_explicit_specialization
-          returning an error_mark_node.  */
-       if (decl == error_mark_node)
-         return error_mark_node;
-
        if (staticp == 1)
          {
            int illegal_static = 0;
index 2af40a8601864864ead997ab9b02ce87d86400ef..184832ccbca66a01883c8bd04f295a3f0c1a815e 100644 (file)
@@ -688,6 +688,8 @@ maybe_process_partial_specialization (type)
       else if (CLASSTYPE_TEMPLATE_INSTANTIATION (type))
        cp_error ("specialization of `%T' after instantiation", type);
     }
+  else if (processing_specialization)
+    cp_error ("explicit specialization of non-template `%T'", type);
 }
 
 /* Retrieve the specialization (in the sense of [temp.spec] - a