Commit d097567d by Jason Merrill Committed by Jason Merrill

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
parent 105249d1
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> 2010-01-04 Jason Merrill <jason@redhat.com>
PR c++/42555 PR c++/42555
......
...@@ -5665,8 +5665,12 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) ...@@ -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 tmpl = TI_TEMPLATE (cand->template_decl);
tree realparm = chain_index (j, DECL_ARGUMENTS (cand->fn)); tree realparm = chain_index (j, DECL_ARGUMENTS (cand->fn));
tree patparm = get_pattern_parm (realparm, tmpl); 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", pedwarn (input_location, 0, "deducing %qT as %qT",
non_reference (TREE_TYPE (patparm)), non_reference (TREE_TYPE (patparm)),
......
...@@ -14047,6 +14047,9 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms, ...@@ -14047,6 +14047,9 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms,
if (!skip_arg_p) 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)) if (unify (tparms, targs, parm, arg, arg_strict))
return 1; return 1;
} }
......
2010-01-05 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/initlist30.C: New test.
2010-01-05 Richard Guenther <rguenther@suse.de> 2010-01-05 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42614 PR tree-optimization/42614
......
// 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});
}
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