Commit 20496fa2 by Jason Merrill Committed by Jason Merrill

decl.c (grokfndecl): Return NULL_TREE instead of error_mark_node.

	* 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
parent 0c63f729
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> 1999-02-10 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (grokdeclarator): Catch wierd declarators. * decl.c (grokdeclarator): Catch wierd declarators.
......
...@@ -8344,7 +8344,7 @@ bad_specifiers (object, type, virtualp, quals, inlinep, friendp, raises) ...@@ -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 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. 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. */ applicable error messages. */
static tree static tree
...@@ -8496,7 +8496,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, ...@@ -8496,7 +8496,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
/* Something like `template <class T> friend void f<T>()'. */ /* Something like `template <class T> friend void f<T>()'. */
cp_error ("template-id `%D' in declaration of primary template", cp_error ("template-id `%D' in declaration of primary template",
orig_declarator); orig_declarator);
return error_mark_node; return NULL_TREE;
} }
/* A friend declaration of the form friend void f<>(). Record /* A friend declaration of the form friend void f<>(). Record
...@@ -8544,7 +8544,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, ...@@ -8544,7 +8544,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
2 * (funcdef_flag != 0) + 2 * (funcdef_flag != 0) +
4 * (friendp != 0)); 4 * (friendp != 0));
if (decl == error_mark_node) if (decl == error_mark_node)
return error_mark_node; return NULL_TREE;
if ((! TYPE_FOR_JAVA (ctype) || check_java_method (decl)) if ((! TYPE_FOR_JAVA (ctype) || check_java_method (decl))
&& check) && check)
...@@ -8560,7 +8560,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, ...@@ -8560,7 +8560,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
return tmp; return tmp;
} }
if (! grok_ctor_properties (ctype, decl)) if (! grok_ctor_properties (ctype, decl))
return error_mark_node; return NULL_TREE;
} }
else else
{ {
...@@ -8577,7 +8577,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, ...@@ -8577,7 +8577,7 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
2 * (funcdef_flag != 0) + 2 * (funcdef_flag != 0) +
4 * (friendp != 0)); 4 * (friendp != 0));
if (decl == error_mark_node) if (decl == error_mark_node)
return error_mark_node; return NULL_TREE;
if (ctype != NULL_TREE if (ctype != NULL_TREE
&& (! TYPE_FOR_JAVA (ctype) || check_java_method (decl)) && (! TYPE_FOR_JAVA (ctype) || check_java_method (decl))
...@@ -10931,7 +10931,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -10931,7 +10931,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
virtualp, flags, quals, raises, attrlist, virtualp, flags, quals, raises, attrlist,
friendp ? -1 : 0, friendp, publicp, inlinep, friendp ? -1 : 0, friendp, publicp, inlinep,
funcdef_flag, template_count, in_namespace); funcdef_flag, template_count, in_namespace);
if (decl == NULL_TREE || decl == error_mark_node) if (decl == NULL_TREE)
return decl; return decl;
#if 0 #if 0
/* This clobbers the attrs stored in `decl' from `attrlist'. */ /* This clobbers the attrs stored in `decl' from `attrlist'. */
...@@ -11178,11 +11178,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -11178,11 +11178,6 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (decl == NULL_TREE) if (decl == NULL_TREE)
return 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) if (staticp == 1)
{ {
int illegal_static = 0; int illegal_static = 0;
......
...@@ -688,6 +688,8 @@ maybe_process_partial_specialization (type) ...@@ -688,6 +688,8 @@ maybe_process_partial_specialization (type)
else if (CLASSTYPE_TEMPLATE_INSTANTIATION (type)) else if (CLASSTYPE_TEMPLATE_INSTANTIATION (type))
cp_error ("specialization of `%T' after 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 /* Retrieve the specialization (in the sense of [temp.spec] - a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment