PR c++/43621
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Apr 2010 16:10:47 +0000 (16:10 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Apr 2010 16:10:47 +0000 (16:10 +0000)
* pt.c (maybe_update_decl_type): Check the return value from
push_scope.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158006 138bc75d-0d04-0410-961f-82ee72b054a4

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

index ee75c46..9a2f01d 100644 (file)
@@ -1,3 +1,9 @@
+2010-04-06  Jason Merrill  <jason@redhat.com>
+
+       PR c++/43621
+       * pt.c (maybe_update_decl_type): Check the return value from
+       push_scope.
+
 2010-04-01  Jason Merrill  <jason@redhat.com>
 
        * decl.c (next_initializable_field): No longer static.
index 3e2927c..0bd55e1 100644 (file)
@@ -3720,15 +3720,17 @@ maybe_update_decl_type (tree orig_type, tree scope)
         TYPENAME_TYPEs and SCOPE_REFs that were previously dependent.  */
       tree args = current_template_args ();
       tree auto_node = type_uses_auto (type);
+      tree pushed;
       if (auto_node)
        {
          tree auto_vec = make_tree_vec (1);
          TREE_VEC_ELT (auto_vec, 0) = auto_node;
          args = add_to_template_args (args, auto_vec);
        }
-      push_scope (scope);
+      pushed = push_scope (scope);
       type = tsubst (type, args, tf_warning_or_error, NULL_TREE);
-      pop_scope (scope);
+      if (pushed)
+       pop_scope (scope);
     }
 
   if (type == error_mark_node)
index 22f8934..d1acb39 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-06  Jason Merrill  <jason@redhat.com>
+
+       PR c++/43621
+       * g++.dg/template/error-recovery2.C: New.
+
 2010-04-06  Jan Hubicka  <jh@suse.czpli
 
        PR tree-optimization/42906
diff --git a/gcc/testsuite/g++.dg/template/error-recovery2.C b/gcc/testsuite/g++.dg/template/error-recovery2.C
new file mode 100644 (file)
index 0000000..d5ce123
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/43621
+
+template <typename T>
+class A {
+  template <typename>
+  A<T> A<T>::f();              // { dg-error "extra qualification" }
+};