Commit fd4198e6 by Jason Merrill Committed by Jason Merrill

re PR c++/50086 ([C++0x] Error on lookup of template function address with…

re PR c++/50086 ([C++0x] Error on lookup of template function address with variadic template arguments)

	PR c++/50086
	* pt.c (unify_pack_expansion): Correct overloaded unification
	logic.

From-SVN: r177813
parent 41669f51
2011-08-16 Jason Merrill <jason@redhat.com> 2011-08-16 Jason Merrill <jason@redhat.com>
PR c++/50086
* pt.c (unify_pack_expansion): Correct overloaded unification
logic.
* pt.c (instantiate_class_template_1): If DECL_PRESERVE_P is set * pt.c (instantiate_class_template_1): If DECL_PRESERVE_P is set
on a member function or static data member, call mark_used. on a member function or static data member, call mark_used.
......
...@@ -15434,7 +15434,6 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms, ...@@ -15434,7 +15434,6 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms,
tree arg = TREE_VEC_ELT (packed_args, i); tree arg = TREE_VEC_ELT (packed_args, i);
tree arg_expr = NULL_TREE; tree arg_expr = NULL_TREE;
int arg_strict = strict; int arg_strict = strict;
bool skip_arg_p = false;
if (call_args_p) if (call_args_p)
{ {
...@@ -15477,19 +15476,15 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms, ...@@ -15477,19 +15476,15 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms,
if (resolve_overloaded_unification if (resolve_overloaded_unification
(tparms, targs, parm, arg, (tparms, targs, parm, arg,
(unification_kind_t) strict, (unification_kind_t) strict,
sub_strict, explain_p) sub_strict, explain_p))
!= 0) goto unified;
return 1; return unify_overload_resolution_failure (explain_p, arg);
skip_arg_p = true;
} }
if (!skip_arg_p) arg_expr = arg;
{ arg = unlowered_expr_type (arg);
arg_expr = arg; if (arg == error_mark_node)
arg = unlowered_expr_type (arg); return unify_invalid (explain_p);
if (arg == error_mark_node)
return 1;
}
} }
arg_strict = sub_strict; arg_strict = sub_strict;
...@@ -15500,16 +15495,14 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms, ...@@ -15500,16 +15495,14 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms,
&parm, &arg, arg_expr); &parm, &arg, arg_expr);
} }
if (!skip_arg_p) /* For deduction from an init-list we need the actual list. */
{ if (arg_expr && BRACE_ENCLOSED_INITIALIZER_P (arg_expr))
/* For deduction from an init-list we need the actual list. */ arg = arg_expr;
if (arg_expr && BRACE_ENCLOSED_INITIALIZER_P (arg_expr)) RECUR_AND_CHECK_FAILURE (tparms, targs, parm, arg, arg_strict,
arg = arg_expr; explain_p);
RECUR_AND_CHECK_FAILURE (tparms, targs, parm, arg, arg_strict,
explain_p);
}
} }
unified:
/* For each parameter pack, collect the deduced value. */ /* For each parameter pack, collect the deduced value. */
for (pack = packs; pack; pack = TREE_CHAIN (pack)) for (pack = packs; pack; pack = TREE_CHAIN (pack))
{ {
......
2011-08-16 Jason Merrill <jason@redhat.com> 2011-08-16 Jason Merrill <jason@redhat.com>
PR c++/50086
* g++.dg/cpp0x/variadic-unresolved.C: New.
* g++.old-deja/g++.brendan/README: Add R.I.P. * g++.old-deja/g++.brendan/README: Add R.I.P.
* g++.dg/ext/attr-used-1.C: New. * g++.dg/ext/attr-used-1.C: New.
......
// PR c++/50086
// { dg-options -std=c++0x }
template<typename T> void tfun();
template<typename T> void fun1(T);
template<typename... Types> void fun2(Types... args);
int main()
{
fun1(tfun<int>); // ok
fun2(tfun<int>); // error: unresolved overloaded function type
}
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