Commit 70ba2484 by Jason Merrill Committed by Jason Merrill

re PR c++/53039 (including <functional> breaks std::is_convertible with template-pack expansion)

	PR c++/53039
	* pt.c (arg_from_parm_pack_p): Go back to using same_type_p or
	cp_tree_equal.

From-SVN: r189305
parent 9ae8d9df
2012-07-05 Jason Merrill <jason@redhat.com> 2012-07-05 Jason Merrill <jason@redhat.com>
PR c++/53039
* pt.c (arg_from_parm_pack_p): Go back to using same_type_p or
cp_tree_equal.
* cp-tree.h (TEMPLATE_PARM_NUM_SIBLINGS): Remove. * cp-tree.h (TEMPLATE_PARM_NUM_SIBLINGS): Remove.
(struct template_parm_index_s): Remove num_siblings. (struct template_parm_index_s): Remove num_siblings.
* pt.c (fixup_template_parms, fixup_template_parm_index): Remove. * pt.c (fixup_template_parms, fixup_template_parm_index): Remove.
......
...@@ -3760,34 +3760,13 @@ arg_from_parm_pack_p (tree arg_pack, tree parm_pack) ...@@ -3760,34 +3760,13 @@ arg_from_parm_pack_p (tree arg_pack, tree parm_pack)
{ {
tree expansion = TREE_VEC_ELT (ARGUMENT_PACK_ARGS (arg_pack), 0); tree expansion = TREE_VEC_ELT (ARGUMENT_PACK_ARGS (arg_pack), 0);
tree pattern = PACK_EXPANSION_PATTERN (expansion); tree pattern = PACK_EXPANSION_PATTERN (expansion);
/* So we have an argument_pack<P...>. We want to test if P if ((TYPE_P (pattern) && same_type_p (pattern, parm_pack))
is actually PARM_PACK. We will not use cp_tree_equal to || (!TYPE_P (pattern) && cp_tree_equal (parm_pack, pattern)))
test P and PARM_PACK because during type fixup (by /* The argument pack that the parameter maps to is just an
fixup_template_parm) P can be a pre-fixup version of a expansion of the parameter itself, such as one would
type and PARM_PACK be its post-fixup version. find in the implicit typedef of a class inside the
cp_tree_equal would consider them as different even class itself. Consider this parameter "unsubstituted",
though we would want to consider them compatible for our so that we will maintain the outer pack expansion. */
precise purpose here.
Thus we are going to consider that P and PARM_PACK are
compatible if they have the same DECL. */
if ((/* If ARG_PACK is a type parameter pack named by the
same DECL as parm_pack ... */
(TYPE_P (pattern)
&& TYPE_P (parm_pack)
&& TYPE_NAME (pattern) == TYPE_NAME (parm_pack))
/* ... or if PARM_PACK is a non-type parameter named by the
same DECL as ARG_PACK. Note that PARM_PACK being a
non-type parameter means it's either a PARM_DECL or a
TEMPLATE_PARM_INDEX. */
|| (TREE_CODE (pattern) == TEMPLATE_PARM_INDEX
&& ((TREE_CODE (parm_pack) == PARM_DECL
&& (TEMPLATE_PARM_DECL (pattern)
== TEMPLATE_PARM_DECL (DECL_INITIAL (parm_pack))))
|| (TREE_CODE (parm_pack) == TEMPLATE_PARM_INDEX
&& (TEMPLATE_PARM_DECL (pattern)
== TEMPLATE_PARM_DECL (parm_pack))))))
&& template_parameter_pack_p (pattern))
return true; return true;
} }
return false; return false;
......
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