re PR c++/19980 (ICE on invalid template declaration)

PR c++/19980
	* decl.c (start_preparsed_function): Robustify.

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

From-SVN: r96872
This commit is contained in:
Volker Reichelt 2005-03-22 15:07:04 +00:00 committed by Volker Reichelt
parent 0f3744f8c2
commit 11e9773775
4 changed files with 23 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2005-03-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/19980
* decl.c (start_preparsed_function): Robustify.
2005-03-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/20499

View File

@ -10009,7 +10009,12 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
class scope, current_class_type will be NULL_TREE until set above
by push_nested_class.) */
if (processing_template_decl)
decl1 = push_template_decl (decl1);
{
/* FIXME: Handle error_mark_node more gracefully. */
tree newdecl1 = push_template_decl (decl1);
if (newdecl1 != error_mark_node)
decl1 = newdecl1;
}
/* We are now in the scope of the function being defined. */
current_function_decl = decl1;

View File

@ -1,3 +1,8 @@
2005-03-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/19980
* g++.dg/template/redecl3.C: New test.
2005-03-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/20499

View File

@ -0,0 +1,7 @@
// PR c++/19980
// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
// { dg-do compile }
int foo; // { dg-error "previous declaration" }
template<int> void foo() {} // { dg-error "redeclared" }