OSDN Git Service

PR c++/40595
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 30 Jun 2009 19:36:36 +0000 (19:36 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 30 Jun 2009 19:36:36 +0000 (19:36 +0000)
* pt.c (tsubst_pack_expansion): Handle unexpanded packs in an
EXPR_PACK_EXPANSION.

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

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

index dbca775..4e85a95 100644 (file)
@@ -1,3 +1,9 @@
+2009-06-30  Jason Merrill  <jason@redhat.com>
+
+       PR c++/40595
+       * pt.c (tsubst_pack_expansion): Handle unexpanded packs in an
+       EXPR_PACK_EXPANSION.
+
 2009-06-29  Jason Merrill  <jason@redhat.com>
 
        PR c++/40274
index e0a413b..b7c309d 100644 (file)
@@ -7630,8 +7630,15 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
      and return a PACK_EXPANSION_*. The caller will need to deal with
      that.  */
   if (unsubstituted_packs)
-    return make_pack_expansion (tsubst (pattern, args, complain, 
-                                       in_decl));
+    {
+      tree new_pat;
+      if (TREE_CODE (t) == EXPR_PACK_EXPANSION)
+       new_pat = tsubst_expr (pattern, args, complain, in_decl,
+                              /*integral_constant_expression_p=*/false);
+      else
+       new_pat = tsubst (pattern, args, complain, in_decl);
+      return make_pack_expansion (new_pat);
+    }
 
   /* We could not find any argument packs that work.  */
   if (len < 0)
index 8287bbb..a8d5141 100644 (file)
@@ -1,3 +1,8 @@
+2009-06-30  Jason Merrill  <jason@redhat.com>
+
+       PR c++/40595
+       * g++.dg/cpp0x/variadic94.C: New.
+
 2009-06-30  Richard Sandiford  <r.sandiford@uk.ibm.com>
 
        * lib/gcc-defs.exp (gcc-set-multilib-library-path): Delete.
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic94.C b/gcc/testsuite/g++.dg/cpp0x/variadic94.C
new file mode 100644 (file)
index 0000000..8420f73
--- /dev/null
@@ -0,0 +1,33 @@
+// PR c++/40595
+// { dg-options "-std=c++0x" }
+
+template<int N>
+struct S
+{
+    typedef int type;
+};
+
+template<typename T>
+struct Get
+{
+    static T get();
+};
+
+template<typename F>
+struct B
+{
+    template<typename ... Args>
+        typename S<sizeof( Get<F>::get() (Get<Args>::get() ...) )>::type
+        f(Args&& ... a);
+};
+
+struct X
+{
+    bool operator()(int) const;
+};
+
+int main()
+{
+    B<X> b;
+    b.f(1);
+}