Commit ebcb4bc3 by Dodji Seketeli Committed by Dodji Seketeli

re PR c++/47326 ([C++0x] ICE in tsubst_copy (triggered by dependency of return…

re PR c++/47326 ([C++0x] ICE in tsubst_copy (triggered by dependency of return type on parameter pack size))

PR c++/47326

gcc/cp/

	PR c++/47326
	* pt.c (tsubst_copy)<case SIZEOF_EXPR>: Ensure that even pack
	expansion arguments are not evaluated.

gcc/testsuite/

	PR c++/47326
	* g++.dg/cpp0x/variadic106.C: New test.

From-SVN: r170222
parent 036e0d4f
2011-02-16 Dodji Seketeli <dodji@redhat.com>
PR c++/47326
* pt.c (tsubst_copy)<case SIZEOF_EXPR>: Ensure that even pack
expansion arguments are not evaluated.
2011-02-16 Jakub Jelinek <jakub@redhat.com>
PR c++/47704
......
......@@ -11382,11 +11382,18 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
case SIZEOF_EXPR:
if (PACK_EXPANSION_P (TREE_OPERAND (t, 0)))
{
/* We only want to compute the number of arguments. */
tree expanded = tsubst_pack_expansion (TREE_OPERAND (t, 0), args,
complain, in_decl);
tree expanded;
int len = 0;
++cp_unevaluated_operand;
++c_inhibit_evaluation_warnings;
/* We only want to compute the number of arguments. */
expanded = tsubst_pack_expansion (TREE_OPERAND (t, 0), args,
complain, in_decl);
--cp_unevaluated_operand;
--c_inhibit_evaluation_warnings;
if (TREE_CODE (expanded) == TREE_VEC)
len = TREE_VEC_LENGTH (expanded);
......
2011-02-16 Dodji Seketeli <dodji@redhat.com>
PR c++/47326
* g++.dg/cpp0x/variadic106.C: New test.
2011-02-16 Jakub Jelinek <jakub@redhat.com>
PR libfortran/47757
......
// Origin: PR c++/47326
// { dg-options "-std=c++0x" }
// { dg-do compile }
template <int _N>
struct A
{
typedef int value_type;
};
template <typename... _ARGS>
auto
f (_ARGS... args) -> typename A<sizeof...(args)>::value_type
{
return 12;
}
int
main()
{
f(1,2);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment