]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/35828 ([C++0x] ICE on default template template parameter in template function)
authorJason Merrill <jason@redhat.com>
Tue, 7 Jul 2009 22:03:42 +0000 (18:03 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 7 Jul 2009 22:03:42 +0000 (18:03 -0400)
PR c++/35828
* pt.c (tsubst_decl): Don't abort if we didn't change anything
in a TEMPLATE_DECL's args.

From-SVN: r149351

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

index aa28747c85690442808ec78f35f644ae68fcb3f4..051faf6e62256783c470a6a4d95531af18afa17d 100644 (file)
@@ -1,3 +1,9 @@
+2009-07-07  Jason Merrill  <jason@redhat.com>
+
+       PR c++/35828
+       * pt.c (tsubst_decl): Don't abort if we didn't change anything
+       in a TEMPLATE_DECL's args.
+
 2009-07-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        * semantics.c (finalize_nrv_r): Replace EXPR_LOCUS by
index 2fc2223703c0970e52768bc3f7a9bf7e7c652618..b4bd465860e2db83ce37d38552d76baa17cb69e0 100644 (file)
@@ -8306,8 +8306,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
     case TEMPLATE_DECL:
       {
        /* We can get here when processing a member function template,
-          member class template, and template template parameter of
-          a template class.  */
+          member class template, or template template parameter.  */
        tree decl = DECL_TEMPLATE_RESULT (t);
        tree spec;
        tree tmpl_args;
@@ -8351,10 +8350,10 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
        if (full_args == error_mark_node)
          return error_mark_node;
 
-       /* tsubst_template_args doesn't copy the vector if
-          nothing changed.  But, *something* should have
-          changed.  */
-       gcc_assert (full_args != tmpl_args);
+       /* If this is a default template template argument,
+          tsubst might not have changed anything.  */
+       if (full_args == tmpl_args)
+         return t;
 
        hash = hash_tmpl_and_args (t, full_args);
        spec = retrieve_specialization (t, full_args, hash);
index 9e4ec3defb15aad55c086365a12eb5eb88366c45..3f35f440fd93864c870f9f3c757f38f5e4d0acd0 100644 (file)
@@ -1,5 +1,8 @@
 2009-07-07  Jason Merrill  <jason@redhat.com>
 
+       PR c++/35828
+       * g++.dg/template/defarg12.C: New.
+
        PR c++/37816
        * g++.dg/cpp0x/enum7.C: New.
 
diff --git a/gcc/testsuite/g++.dg/template/defarg12.C b/gcc/testsuite/g++.dg/template/defarg12.C
new file mode 100644 (file)
index 0000000..d11848a
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/35828
+// { dg-options "-std=c++0x" }
+
+template < typename > struct A ;
+template < template < typename > class = A >
+void test ()
+{
+        test ();
+}
+
This page took 0.107506 seconds and 5 git commands to generate.