aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-11-07 12:51:16 -0500
committerJason Merrill <jason@gcc.gnu.org>2011-11-07 12:51:16 -0500
commitb12e4c429258129df86a23dbc1143f0e48f6ba53 (patch)
tree0a913208222d0d411ef29b8b2eb99725d0b35cf2 /gcc
parent200feb074bdd154bb04c3da339224b37997a8f6c (diff)
downloadgcc-b12e4c429258129df86a23dbc1143f0e48f6ba53.zip
gcc-b12e4c429258129df86a23dbc1143f0e48f6ba53.tar.gz
gcc-b12e4c429258129df86a23dbc1143f0e48f6ba53.tar.bz2
decl.c (cp_finish_decl): Only make_tree_vector if we're calling check_initializer.
* decl.c (cp_finish_decl): Only make_tree_vector if we're calling check_initializer. From-SVN: r181099
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c7
2 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 201c2c1..66b4e51 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2011-11-07 Jason Merrill <jason@redhat.com>
+
+ * decl.c (cp_finish_decl): Only make_tree_vector if we're calling
+ check_initializer.
+
2011-11-06 Jason Merrill <jason@redhat.com>
PR c++/35688
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index d2daf91..3b283d8 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6049,9 +6049,12 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
/* This variable seems to be a non-dependent constant, so process
its initializer. If check_initializer returns non-null the
initialization wasn't constant after all. */
- tree init_code = check_initializer (decl, init, flags, &cleanups);
+ tree init_code;
+ cleanups = make_tree_vector ();
+ init_code = check_initializer (decl, init, flags, &cleanups);
if (init_code == NULL_TREE)
init = NULL_TREE;
+ release_tree_vector (cleanups);
}
else if (!DECL_PRETTY_FUNCTION_P (decl))
/* Deduce array size even if the initializer is dependent. */
@@ -6150,6 +6153,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
error ("Java object %qD not allocated with %<new%>", decl);
init = NULL_TREE;
}
+ cleanups = make_tree_vector ();
init = check_initializer (decl, init, flags, &cleanups);
/* Thread-local storage cannot be dynamically initialized. */
if (DECL_THREAD_LOCAL_P (decl) && init)
@@ -6320,6 +6324,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
unsigned i; tree t;
FOR_EACH_VEC_ELT (tree, cleanups, i, t)
push_cleanup (decl, t, false);
+ release_tree_vector (cleanups);
}
if (was_readonly)