From 0078f2869e8ef66d2734e0c91374fec445a5d965 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 29 Nov 2012 16:58:04 -0500 Subject: [PATCH] re PR c++/51662 (Temporary objects gets garbage collected in cc1plus) PR c++/51662 * method.c (process_subob_fn): Increment function_depth around call to instantiate_decl. From-SVN: r193969 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/method.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f93ab4a104e7..e2642a9c8f3d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2012-11-29 Jason Merrill + + PR c++/51662 + * method.c (process_subob_fn): Increment function_depth around call to + instantiate_decl. + 2012-11-29 Kai Tietz PR target/53912 diff --git a/gcc/cp/method.c b/gcc/cp/method.c index f7198d59077a..177948a44383 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -952,7 +952,11 @@ process_subob_fn (tree fn, bool move_p, tree *spec_p, bool *trivial_p, really constexpr. */ if (DECL_DECLARED_CONSTEXPR_P (fn) && DECL_TEMPLATE_INSTANTIATION (fn) && !DECL_TEMPLATE_INSTANTIATED (fn)) - instantiate_decl (fn, /*defer_ok*/false, /*expl_class*/false); + { + ++function_depth; + instantiate_decl (fn, /*defer_ok*/false, /*expl_class*/false); + --function_depth; + } if (!DECL_DECLARED_CONSTEXPR_P (fn)) *constexpr_p = false; } -- 2.47.2