]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/39863 ([c++0x] variadic templates : wrong error "mismatched argument pack...
authorJason Merrill <jason@redhat.com>
Wed, 7 Oct 2009 18:56:39 +0000 (14:56 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 7 Oct 2009 18:56:39 +0000 (14:56 -0400)
PR c++/39863
* pt.c (tsubst_pack_expansion): Don't do anything now if we
have incomplete packs of different lengths.

From-SVN: r152537

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

index bb4ec8d5bc2e371f710219c71c6e25d2954dbaa4..cc6fa63515b07e3a95b29b14041807d40ca23493 100644 (file)
@@ -1,5 +1,9 @@
 2009-10-07  Jason Merrill  <jason@redhat.com>
 
+       PR c++/39863
+       * pt.c (tsubst_pack_expansion): Don't do anything now if we
+       have incomplete packs of different lengths.
+
        PR c++/41038
        * tree.c (build_qualified_name): Call convert_from_reference.
 
index 6b98956d6e61bf841ed6d1cc2d84ac9f7b619e37..9ef3f79a599af0a7f5c8a92948d849288534f554 100644 (file)
@@ -7944,6 +7944,10 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
             }
           else if (len != my_len)
             {
+             if (incomplete)
+               /* We got explicit args for some packs but not others;
+                  do nothing now and try again after deduction.  */
+               return t;
               if (TREE_CODE (t) == TYPE_PACK_EXPANSION)
                 error ("mismatched argument pack lengths while expanding "
                        "%<%T%>",
index a7b7a16508a0f9f80d6cb0619d275b3a8d51b49a..fe14298215ebbc6fa872c24ddb19f15e57633809 100644 (file)
@@ -1,3 +1,7 @@
+2009-10-07  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/cpp0x/variadic95.C: New.
+
 2009-10-07  Jason Merrill  <jason@redhat.com>
 
        * g++.dg/template/scope3.C: New.
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic95.C b/gcc/testsuite/g++.dg/cpp0x/variadic95.C
new file mode 100644 (file)
index 0000000..ebb04eb
--- /dev/null
@@ -0,0 +1,17 @@
+// PR c++/39863
+// { dg-options -std=c++0x }
+
+template <typename... T>
+struct A {};
+
+template <typename T, typename U>
+struct S {};
+
+template <typename... T, typename... U>
+A< S<T, U>... > f(U... u)
+{ return A< S<T, U>... >(); }
+
+int main()
+{
+  f<int>(0.0);
+}