aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-03-30 18:34:02 -0400
committerJason Merrill <jason@gcc.gnu.org>2010-03-30 18:34:02 -0400
commit745370784f44000eab2fada5b93aa62e513c575c (patch)
treeab94c5c4fb4d5c3e87c4882aa89cfe910d132d8a /gcc
parentfb077955541f329953d7f1e4e6c026e62faa30a8 (diff)
downloadgcc-745370784f44000eab2fada5b93aa62e513c575c.zip
gcc-745370784f44000eab2fada5b93aa62e513c575c.tar.gz
gcc-745370784f44000eab2fada5b93aa62e513c575c.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c3
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/template/error-recovery1.C9
4 files changed, 19 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2f6ae04..9138ee1 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index a58dba2..a8e1b78 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a561219..818dbde 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/g++.dg/template/error-recovery1.C b/gcc/testsuite/g++.dg/template/error-recovery1.C
new file mode 100644
index 0000000..ef9dc14
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/error-recovery1.C
@@ -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 "" }