Commit 4366e1c0 by Jason Merrill Committed by Jason Merrill

pt.c (reduce_template_parm_level): Also build the TYPE_DECL for a template template parameter.

	* pt.c (reduce_template_parm_level): Also build the TYPE_DECL
	for a template template parameter.
	(tsubst_decl) [TEMPLATE_DECL]: Use the TEMPLATE_DECL built
	by reduce_template_parm_level.

From-SVN: r225495
parent d762287d
2015-07-06 Jason Merrill <jason@redhat.com> 2015-07-06 Jason Merrill <jason@redhat.com>
* pt.c (reduce_template_parm_level): Also build the TYPE_DECL
for a template template parameter.
(tsubst_decl) [TEMPLATE_DECL]: Use the TEMPLATE_DECL built
by reduce_template_parm_level.
* pt.c (argument_pack_element_is_expansion_p): A decl pack is an * pt.c (argument_pack_element_is_expansion_p): A decl pack is an
expansion. expansion.
......
...@@ -3740,9 +3740,14 @@ reduce_template_parm_level (tree index, tree type, int levels, tree args, ...@@ -3740,9 +3740,14 @@ reduce_template_parm_level (tree index, tree type, int levels, tree args,
/* Template template parameters need this. */ /* Template template parameters need this. */
if (TREE_CODE (decl) == TEMPLATE_DECL) if (TREE_CODE (decl) == TEMPLATE_DECL)
DECL_TEMPLATE_PARMS (decl) = tsubst_template_parms {
(DECL_TEMPLATE_PARMS (TEMPLATE_PARM_DECL (index)), DECL_TEMPLATE_RESULT (decl)
args, complain); = build_decl (DECL_SOURCE_LOCATION (decl),
TYPE_DECL, DECL_NAME (decl), type);
DECL_ARTIFICIAL (DECL_TEMPLATE_RESULT (decl)) = true;
DECL_TEMPLATE_PARMS (decl) = tsubst_template_parms
(DECL_TEMPLATE_PARMS (orig_decl), args, complain);
}
} }
return TEMPLATE_PARM_DESCENDANTS (index); return TEMPLATE_PARM_DESCENDANTS (index);
...@@ -10687,22 +10692,15 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) ...@@ -10687,22 +10692,15 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
/* Template template parameter is treated here. */ /* Template template parameter is treated here. */
tree new_type = tsubst (TREE_TYPE (t), args, complain, in_decl); tree new_type = tsubst (TREE_TYPE (t), args, complain, in_decl);
if (new_type == error_mark_node) if (new_type == error_mark_node)
RETURN (error_mark_node); r = error_mark_node;
/* If we get a real template back, return it. This can happen in /* If we get a real template back, return it. This can happen in
the context of most_specialized_partial_spec. */ the context of most_specialized_partial_spec. */
if (TREE_CODE (new_type) == TEMPLATE_DECL) else if (TREE_CODE (new_type) == TEMPLATE_DECL)
return new_type; r = new_type;
else
r = copy_decl (t); /* The new TEMPLATE_DECL was built in
DECL_CHAIN (r) = NULL_TREE; reduce_template_parm_level. */
TREE_TYPE (r) = new_type; r = TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (new_type);
DECL_TEMPLATE_RESULT (r)
= build_decl (DECL_SOURCE_LOCATION (decl),
TYPE_DECL, DECL_NAME (decl), new_type);
DECL_TEMPLATE_PARMS (r)
= tsubst_template_parms (DECL_TEMPLATE_PARMS (t), args,
complain);
TYPE_NAME (new_type) = r;
break; break;
} }
......
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