OSDN Git Service

PR c++/52292
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Apr 2012 03:40:34 +0000 (03:40 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 16 Apr 2012 03:40:34 +0000 (03:40 +0000)
PR c++/52380
* pt.c (coerce_template_parms): Even if we aren't converting we
want to expand argument packs.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@186481 138bc75d-0d04-0410-961f-82ee72b054a4

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

index e75d32a..a548604 100644 (file)
@@ -1,3 +1,10 @@
+2012-04-15  Jason Merrill  <jason@redhat.com>
+
+       PR c++/52292
+       PR c++/52380
+       * pt.c (coerce_template_parms): Even if we aren't converting we
+       want to expand argument packs.
+
 2012-04-15  Fabien ChĂȘne  <fabien@gcc.gnu.org>
 
        PR c++/52465
index 185212d..3c8fea2 100644 (file)
@@ -6891,7 +6891,7 @@ coerce_template_parms (tree parms,
             {
               /* We don't know how many args we have yet, just
                  use the unconverted ones for now.  */
-              new_inner_args = args;
+              new_inner_args = inner_args;
               break;
             }
         }
index 82324c6..697e8ea 100644 (file)
@@ -1,3 +1,11 @@
+2012-04-15  Jason Merrill  <jason@redhat.com>
+
+       PR c++/52380
+       * g++.dg/cpp0x/variadic125.C: New.
+
+       PR c++/52292
+       * g++.dg/cpp0x/variadic124.C: New.
+
 2012-04-15  Fabien ChĂȘne  <fabien@gcc.gnu.org>
 
        PR c++/52465
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic124.C b/gcc/testsuite/g++.dg/cpp0x/variadic124.C
new file mode 100644 (file)
index 0000000..8ddc810
--- /dev/null
@@ -0,0 +1,29 @@
+// PR c++/52292
+// { dg-options -std=c++11 }
+
+template <template <typename...> class T>
+struct foo {
+    template <typename... U>
+    foo(T<U...> x) { }
+};
+
+template <typename T>
+struct bar {
+    bar(T x) : value(x) { }
+
+    T value;
+};
+
+struct generic : private foo<bar> {
+    template <typename T>
+    generic(bar<T> x) : foo(x)
+    {
+    }
+
+};
+
+int main()
+{
+    bar<int> x(32);
+    generic y(x); // FAILS
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic125.C b/gcc/testsuite/g++.dg/cpp0x/variadic125.C
new file mode 100644 (file)
index 0000000..89fd6b0
--- /dev/null
@@ -0,0 +1,25 @@
+// PR c++/52380
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+struct S
+{
+  template<typename U>
+  struct Unary                        // Line 5
+  {};
+
+  template<unsigned, typename... Args>
+  struct Dispatch                     // Line 9
+    : public Unary<Args...>
+  {};
+
+  template<typename... Args>
+  struct Variadic
+    : public Dispatch<sizeof...(Args), Args...>
+  {};
+};
+
+int main()
+{
+  S<void>::Variadic<void> z;
+}