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
This commit is contained in:
Jakub Jelinek 2007-09-28 11:29:08 +02:00 committed by Jakub Jelinek
parent 6bad46f755
commit 9a3c2683a9
4 changed files with 47 additions and 0 deletions

View 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

View 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] */

View 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

View File

@ -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;
}