]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/43076 (ICE: SIGSEGV with invalid C++ code after giving diagnostics)
authorJason Merrill <jason@redhat.com>
Tue, 30 Mar 2010 22:34:02 +0000 (18:34 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 30 Mar 2010 22:34:02 +0000 (18:34 -0400)
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

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/error-recovery1.C [new file with mode: 0644]

index 2f6ae04daf9fec55966b6d22c0ebabb8feeda406..9138ee1f1aaa05ea136ecfb59a6c80046a66345a 100644 (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
index a58dba29ee3bfc02a7eb33ae958068e7a4b302bc..a8e1b78b73cbd8a92a131d5793894ec2aa53ee44 100644 (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)
index a561219e5aba8686e12a7206da885d0f2a66fd2b..818dbdefb0e0f958f6bfa20fb2fc6406ab76a5a6 100644 (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.
 
diff --git a/gcc/testsuite/g++.dg/template/error-recovery1.C b/gcc/testsuite/g++.dg/template/error-recovery1.C
new file mode 100644 (file)
index 0000000..ef9dc14
--- /dev/null
@@ -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 "" }
This page took 0.091964 seconds and 5 git commands to generate.