pt.c (unify_pack_expansion): Handle deduction from init-list.

* pt.c (unify_pack_expansion): Handle deduction from init-list.
	* call.c (build_over_call): Don't complain about it.

From-SVN: r155653
This commit is contained in:
Jason Merrill 2010-01-05 11:36:45 -05:00 committed by Jason Merrill
parent 105249d140
commit d097567da3
5 changed files with 29 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2010-01-05 Jason Merrill <jason@redhat.com>
* pt.c (unify_pack_expansion): Handle deduction from init-list.
* call.c (build_over_call): Don't complain about it.
2010-01-04 Jason Merrill <jason@redhat.com>
PR c++/42555

View File

@ -5665,8 +5665,12 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
tree tmpl = TI_TEMPLATE (cand->template_decl);
tree realparm = chain_index (j, DECL_ARGUMENTS (cand->fn));
tree patparm = get_pattern_parm (realparm, tmpl);
tree pattype = TREE_TYPE (patparm);
if (PACK_EXPANSION_P (pattype))
pattype = PACK_EXPANSION_PATTERN (pattype);
pattype = non_reference (pattype);
if (!is_std_init_list (non_reference (TREE_TYPE (patparm))))
if (!is_std_init_list (pattype))
{
pedwarn (input_location, 0, "deducing %qT as %qT",
non_reference (TREE_TYPE (patparm)),

View File

@ -14047,6 +14047,9 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms,
if (!skip_arg_p)
{
/* For deduction from an init-list we need the actual list. */
if (arg_expr && BRACE_ENCLOSED_INITIALIZER_P (arg_expr))
arg = arg_expr;
if (unify (tparms, targs, parm, arg, arg_strict))
return 1;
}

View File

@ -1,3 +1,7 @@
2010-01-05 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/initlist30.C: New test.
2010-01-05 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42614

View File

@ -0,0 +1,12 @@
// Testcase for variadic init list deduction.
// { dg-options "-std=c++0x" }
#include <initializer_list>
template <class... Ts>
void f (std::initializer_list<Ts>... ls);
int main()
{
f({1},{2.0});
}