From c7360ed2f9b78a0091b6ce60e8ef7411683efae2 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 11 Nov 2015 19:53:19 -0500 Subject: [PATCH] pt.c (instantiate_class_template_1): Set function_depth around instantiation of lambda op(). * pt.c (instantiate_class_template_1): Set function_depth around instantiation of lambda op(). From-SVN: r230201 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 62992eef6ef..9cbda291ac7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-11-11 Jason Merrill + + * pt.c (instantiate_class_template_1): Set function_depth around + instantiation of lambda op(). + 2015-11-11 Marek Polacek PR c/68107 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 053a4ef2883..62659ec90dc 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -10162,7 +10162,12 @@ instantiate_class_template_1 (tree type) { if (!DECL_TEMPLATE_INFO (decl) || DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (decl)) != decl) - instantiate_decl (decl, false, false); + { + /* Set function_depth to avoid garbage collection. */ + ++function_depth; + instantiate_decl (decl, false, false); + --function_depth; + } /* We need to instantiate the capture list from the template after we've instantiated the closure members, but before we -- 2.30.2