OSDN Git Service

PR c++/31434
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 28 Sep 2007 09:29:08 +0000 (09:29 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 28 Sep 2007 09:29:08 +0000 (09:29 +0000)
* tree.c (cp_build_qualified_type_real): Handle TYPE_PACK_EXPANSION
qualification by creating qualified PACK_EXPANSION_PATTERN and
then calling make_pack_expansion on it.

* g++.dg/cpp0x/variadic80.C: New test.

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

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

index b2a78e3..503af66 100644 (file)
@@ -1,3 +1,10 @@
+2007-09-28  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/31434
+       * tree.c (cp_build_qualified_type_real): Handle TYPE_PACK_EXPANSION
+       qualification by creating qualified PACK_EXPANSION_PATTERN and
+       then calling make_pack_expansion on it.
+
 2007-09-28  Jie Zhang  <jie.zhang@analog.com>
 
        * config.gcc (bfin*-linux-uclibc*): Set extra_parts
index 11181c2..ca767a1 100644 (file)
@@ -773,6 +773,13 @@ cp_build_qualified_type_real (tree type,
       t = cp_build_qualified_type_real (t, type_quals, complain);
       return build_ptrmemfunc_type (t);
     }
+  else if (TREE_CODE (type) == TYPE_PACK_EXPANSION)
+    {
+      tree t = PACK_EXPANSION_PATTERN (type);
+
+      t = cp_build_qualified_type_real (t, type_quals, complain);
+      return make_pack_expansion (t);
+    }
 
   /* A reference or method type shall not be cv qualified.
      [dcl.ref], [dct.fct]  */
index c863096..67e390a 100644 (file)
@@ -1,3 +1,8 @@
+2007-09-28  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/31434
+       * g++.dg/cpp0x/variadic80.C: New test.
+
 2007-09-27  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        * gfortran.dg/namelist_38.f90: Delete test for revertion of
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic80.C b/gcc/testsuite/g++.dg/cpp0x/variadic80.C
new file mode 100644 (file)
index 0000000..a56cdb4
--- /dev/null
@@ -0,0 +1,28 @@
+// PR c++/31434
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+extern "C" void abort ();
+
+template<typename... T> inline int foo (const T...) { return 1; }
+template<typename... T> inline int foo (const T *...) { return 2; }
+
+void
+bar (int *a)
+{
+  a[0] = foo (0);
+  a[1] = foo (*a);
+  a[2] = foo<int> (a);
+  a[3] = foo<int> (2, 3, 4, 5);
+  a[4] = foo<int> (a, a + 1, a + 2);
+}
+
+int
+main ()
+{
+  int a[5];
+  bar (a);
+  if (a[0] != 1 || a[1] != 1 || a[2] != 2 || a[3] != 1 || a[4] != 2)
+    abort ();
+  return 0;
+}