pt.c (instantiate_class_template_1): Set function_depth around instantiation of lambd...
authorJason Merrill <jason@redhat.com>
Thu, 12 Nov 2015 00:53:19 +0000 (19:53 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 12 Nov 2015 00:53:19 +0000 (19:53 -0500)
* pt.c (instantiate_class_template_1): Set function_depth around
instantiation of lambda op().

From-SVN: r230201

gcc/cp/ChangeLog
gcc/cp/pt.c

index 62992eef6ef1d3bdb9899f3a2e49871daafcf59d..9cbda291ac7a58f95a21df5b2a8e9e23c1cd9ed8 100644 (file)
@@ -1,3 +1,8 @@
+2015-11-11  Jason Merrill  <jason@redhat.com>
+
+       * pt.c (instantiate_class_template_1): Set function_depth around
+       instantiation of lambda op().
+
 2015-11-11  Marek Polacek  <polacek@redhat.com>
 
        PR c/68107
index 053a4ef28831d55e9d9104d31c662aa65bfb8442..62659ec90dccef77d7034661dec4d42eccfe7dcd 100644 (file)
@@ -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