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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index f93fa7f..61ca31c 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -13611,6 +13611,7 @@ deduction_tsubst_fntype (tree fn, tree targs)
static bool excessive_deduction_depth;
static int deduction_depth;
location_t save_loc = input_location;
+ struct pending_template *old_last_pend = last_pending_template;
tree fntype = TREE_TYPE (fn);
tree tinst;
@@ -13644,7 +13645,9 @@ deduction_tsubst_fntype (tree fn, tree targs)
}
pop_tinst_level ();
- ggc_free (tinst);
+ /* We can't free this if a pending_template entry is pointing at it. */
+ if (last_pending_template == old_last_pend)
+ ggc_free (tinst);
return r;
}