From 40a380e42321f725c6972edba0d991755eb290c5 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 21 Jun 2018 14:19:38 -0400 Subject: [PATCH] * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Use TEMPLATE_PARM_DESCENDANTS. From-SVN: r261861 --- gcc/cp/ChangeLog | 2 ++ gcc/cp/pt.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 18673c095af..f0e44532348 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,7 @@ 2018-06-21 Jason Merrill + * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Use TEMPLATE_PARM_DESCENDANTS. + * name-lookup.c (do_push_to_top_level): Don't allocate current_lang_base. (do_pop_from_top_level): Release current_lang_base. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c5433dc46ae..69e9479302e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14472,6 +14472,15 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) && !PLACEHOLDER_TYPE_CONSTRAINTS (r)) /* Break infinite recursion when substituting the constraints of a constrained placeholder. */; + else if (TREE_CODE (t) == TEMPLATE_TYPE_PARM + && !PLACEHOLDER_TYPE_CONSTRAINTS (t) + && !CLASS_PLACEHOLDER_TEMPLATE (t) + && (arg = TEMPLATE_TYPE_PARM_INDEX (t), + r = TEMPLATE_PARM_DESCENDANTS (arg)) + && (TEMPLATE_PARM_LEVEL (r) + == TEMPLATE_PARM_LEVEL (arg) - levels)) + /* Cache the simple case of lowering a type parameter. */ + r = TREE_TYPE (r); else { r = copy_type (t); -- 2.30.2