From: jason Date: Thu, 12 Nov 2015 00:53:19 +0000 (+0000) Subject: * pt.c (instantiate_class_template_1): Set function_depth around X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95521921a06ddaf9686e3a9c17dcf5fbd2d33a56;p=thirdparty%2Fgcc.git * pt.c (instantiate_class_template_1): Set function_depth around instantiation of lambda op(). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230201 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 62992eef6ef1..9cbda291ac7a 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 053a4ef28831..62659ec90dcc 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