re PR c++/69743 (function overload with variadic arguments - template instantiation depth exceeds maximum (gcc4, clang - no problem))

PR c++/69743
	* call.c (remaining_arguments): No longer static.
	* cp-tree.h: Declare it.
	* pt.c (more_specialized_fn): Use it.

From-SVN: r233579
This commit is contained in:
Jason Merrill 2016-02-19 23:31:16 -05:00 committed by Jason Merrill
parent 313efd9efb
commit 2207c59959
5 changed files with 29 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2016-02-19 Jason Merrill <jason@redhat.com>
PR c++/69743
* call.c (remaining_arguments): No longer static.
* cp-tree.h: Declare it.
* pt.c (more_specialized_fn): Use it.
2016-02-19 Jakub Jelinek <jakub@redhat.com>
Bernd Edlinger <bernd.edlinger@hotmail.de>

View File

@ -1905,7 +1905,7 @@ add_candidate (struct z_candidate **candidates,
/* Return the number of remaining arguments in the parameter list
beginning with ARG. */
static int
int
remaining_arguments (tree arg)
{
int n;

View File

@ -5612,6 +5612,7 @@ extern tree make_temporary_var_for_ref_to_temp (tree, tree);
extern bool type_has_extended_temps (tree);
extern tree strip_top_quals (tree);
extern bool reference_related_p (tree, tree);
extern int remaining_arguments (tree);
extern tree perform_implicit_conversion (tree, tree, tsubst_flags_t);
extern tree perform_implicit_conversion_flags (tree, tree, tsubst_flags_t, int);
extern tree build_integral_nontype_arg_conv (tree, tree, tsubst_flags_t);

View File

@ -20288,7 +20288,7 @@ more_specialized_fn (tree pat1, tree pat2, int len)
if (TREE_CODE (arg1) == TYPE_PACK_EXPANSION)
{
int i, len2 = list_length (args2);
int i, len2 = remaining_arguments (args2);
tree parmvec = make_tree_vec (1);
tree argvec = make_tree_vec (len2);
tree ta = args2;
@ -20312,7 +20312,7 @@ more_specialized_fn (tree pat1, tree pat2, int len)
}
else if (TREE_CODE (arg2) == TYPE_PACK_EXPANSION)
{
int i, len1 = list_length (args1);
int i, len1 = remaining_arguments (args1);
tree parmvec = make_tree_vec (1);
tree argvec = make_tree_vec (len1);
tree ta = args1;

View File

@ -0,0 +1,18 @@
// PR c++/69743
// { dg-do compile { target c++11 } }
template <typename D, typename... T>
void f(int, T... d)
{
}
template <typename D, typename... T>
void f(T... d)
{
f<D>(1, d...);
}
void g(void)
{
f<long>(1.0);
}