aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 27084a2..c1e12f0 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -9552,7 +9552,7 @@ tsubst_template_parms (tree parms, tree args, tsubst_flags_t complain)
++processing_template_decl;
for (new_parms = &r;
- TMPL_PARMS_DEPTH (parms) > TMPL_ARGS_DEPTH (args);
+ parms && TMPL_PARMS_DEPTH (parms) > TMPL_ARGS_DEPTH (args);
new_parms = &(TREE_CHAIN (*new_parms)),
parms = TREE_CHAIN (parms))
{
@@ -9831,6 +9831,10 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
tree new_type = tsubst (TREE_TYPE (t), args, complain, in_decl);
if (new_type == error_mark_node)
RETURN (error_mark_node);
+ /* If we get a real template back, return it. This can happen in
+ the context of most_specialized_class. */
+ if (TREE_CODE (new_type) == TEMPLATE_DECL)
+ return new_type;
r = copy_decl (t);
DECL_CHAIN (r) = NULL_TREE;