re PR c++/40684 (ICE in tsubst)
authorDodji Seketeli <dodji@redhat.com>
Thu, 9 Jul 2009 17:56:44 +0000 (17:56 +0000)
committerDodji Seketeli <dodji@gcc.gnu.org>
Thu, 9 Jul 2009 17:56:44 +0000 (19:56 +0200)
2009-07-09  Dodji Seketeli  <dodji@redhat.com>

gcc/cp/ChangeLog:
PR c++/40684
* pt.c (type_unification_real): Use tsubst_template_arg instead
of tsubst to substitute default template arguments.

gcc/testsuite/ChangeLog:
PR c++/40684
* g++.dg/template/unify11.C: New test.

From-SVN: r149423

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

index 3919397dfcc3c9a2881bcf9d60d0efb794fe9fdc..8e3b90704c69424686cc0c5e93e6e88b636a6225 100644 (file)
@@ -1,3 +1,9 @@
+2009-07-09  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/40684
+       * pt.c (type_unification_real): Use tsubst_template_arg instead
+       of tsubst to substitute default template arguments.
+
 2009-07-08  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        PR c++/31246
index b4bd465860e2db83ce37d38552d76baa17cb69e0..d042f98f9a3b69e59c883a760bed59c0933367ed 100644 (file)
@@ -12949,8 +12949,9 @@ type_unification_real (tree tparms,
             to explicitly check cxx_dialect here.  */
           if (TREE_PURPOSE (TREE_VEC_ELT (tparms, i)))
             {
-              tree arg = tsubst (TREE_PURPOSE (TREE_VEC_ELT (tparms, i)), 
-                                 targs, tf_none, NULL_TREE);
+              tree arg = tsubst_template_arg
+                               (TREE_PURPOSE (TREE_VEC_ELT (tparms, i)),
+                                targs, tf_none, NULL_TREE);
               if (arg == error_mark_node)
                 return 1;
               else
index e04e25e87536e05798c36bafa6d0130040c4906e..d9f3bfe4e40cf0212369a1cb5d4236a398af8f29 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-09  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/40684
+       * g++.dg/template/unify11.C: New test.
+
 2008-07-09  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/40629
diff --git a/gcc/testsuite/g++.dg/template/unify11.C b/gcc/testsuite/g++.dg/template/unify11.C
new file mode 100644 (file)
index 0000000..c8df94b
--- /dev/null
@@ -0,0 +1,36 @@
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin: PR c++/40684
+// { dg-options "-std=c++0x" }
+
+struct A
+{
+};
+
+template <typename S, typename T, typename U, typename S::v = &S::v::s>
+typename S::A
+foo (S c, T t, U u)
+{
+}
+
+struct B
+{
+  struct C
+  {
+    template <typename U>
+    C (U t)
+    {
+      A a;
+      A b = foo (this, a, t); // { dg-error "no matching function" }
+    }
+  } c;
+  B () : c (A ())
+  {
+  }
+};
+
+int
+main ()
+{
+  B f;
+}
+