aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-09-28 11:29:08 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2007-09-28 11:29:08 +0200
commit9a3c2683a99eee640ea752cfaf5df84d1555de97 (patch)
tree6e6ec0e15c711531f892ed8cd8f723e7d3b5d2c1 /gcc
parent6bad46f7555ebbf45abd37ad40003bdcf64ae4c2 (diff)
downloadgcc-9a3c2683a99eee640ea752cfaf5df84d1555de97.zip
gcc-9a3c2683a99eee640ea752cfaf5df84d1555de97.tar.gz
gcc-9a3c2683a99eee640ea752cfaf5df84d1555de97.tar.bz2
re PR c++/31434 (ICE with invalid use of parameter pack in function arg)
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. * g++.dg/cpp0x/variadic80.C: New test. From-SVN: r128861
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cp/tree.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic80.C28
4 files changed, 47 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b2a78e3..503af66 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 11181c2..ca767a1 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -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] */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c863096..67e390a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..a56cdb4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic80.C
@@ -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;
+}