mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-15 12:41:03 +08:00
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:
parent
105249d140
commit
d097567da3
@ -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
|
||||
|
@ -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)),
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
12
gcc/testsuite/g++.dg/cpp0x/initlist30.C
Normal file
12
gcc/testsuite/g++.dg/cpp0x/initlist30.C
Normal 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});
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user