re PR c++/43076 (ICE: SIGSEGV with invalid C++ code after giving diagnostics)

PR c++/43076
	* pt.c (push_template_decl_real): Deal better with running out of
	scopes before running out of template parms.

From-SVN: r157842
This commit is contained in:
Jason Merrill 2010-03-30 18:34:02 -04:00 committed by Jason Merrill
parent fb07795554
commit 745370784f
4 changed files with 19 additions and 0 deletions

View file

@ -1,5 +1,9 @@
2010-03-30 Jason Merrill <jason@redhat.com>
PR c++/43076
* pt.c (push_template_decl_real): Deal better with running out of
scopes before running out of template parms.
PR c++/41185
PR c++/41786
* parser.c (cp_parser_direct_declarator): Don't allow VLAs in

View file

@ -4548,6 +4548,9 @@ push_template_decl_real (tree decl, bool is_friend)
if (current == decl)
current = ctx;
else if (current == NULL_TREE)
/* Can happen in erroneous input. */
break;
else
current = (TYPE_P (current)
? TYPE_CONTEXT (current)

View file

@ -1,5 +1,8 @@
2010-03-30 Jason Merrill <jason@redhat.com>
PR c++/43076
* g++.dg/template/error-recovery1.C: New.
PR c++/41786
* g++.dg/parse/ambig5.C: New.

View file

@ -0,0 +1,9 @@
// PR c++/43076
struct S;
template < typename > struct T
{
template < typename >
template < bool > struct T < S > // { dg-error "" }
{
void f () { // { dg-error "" }