aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-04-27 21:53:43 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-04-27 21:53:43 -0400
commite79a6b402a7485aa214fc82be04bc5163951aba3 (patch)
tree98387133fcee5f81514d1e3d0ea61a9b1bbfd6e9
parentc12ff9d8f0f20cd2de63de6f14b9f0330e7ceb66 (diff)
downloadgcc-e79a6b402a7485aa214fc82be04bc5163951aba3.zip
gcc-e79a6b402a7485aa214fc82be04bc5163951aba3.tar.gz
gcc-e79a6b402a7485aa214fc82be04bc5163951aba3.tar.bz2
init.c (build_vec_delete_1): Look for sfk_deleting_destructor to decide whether to delete.
* init.c (build_vec_delete_1): Look for sfk_deleting_destructor to decide whether to delete. (build_vec_init): Pass sfk_complete_destructor. From-SVN: r173057
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/init.c18
2 files changed, 12 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 737ba2e..0f18167 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2011-04-27 Jason Merrill <jason@redhat.com>
+ * init.c (build_vec_delete_1): Look for sfk_deleting_destructor to
+ decide whether to delete.
+ (build_vec_init): Pass sfk_complete_destructor.
+
PR c++/40975
* cp-tree.def (VEC_INIT_EXPR): Add third operand.
* cp-tree.h (VEC_INIT_EXPR_NELTS): New.
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 883734f..3f88857 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2793,9 +2793,8 @@ build_vec_delete_1 (tree base, tree maxindex, tree type,
loop = build_compound_expr (input_location, tbase_init, loop);
no_destructor:
- /* If the delete flag is one, or anything else with the low bit set,
- delete the storage. */
- if (auto_delete_vec != sfk_base_destructor)
+ /* Delete the storage if appropriate. */
+ if (auto_delete_vec == sfk_deleting_destructor)
{
tree base_tbd;
@@ -2824,12 +2823,11 @@ build_vec_delete_1 (tree base, tree maxindex, tree type,
virtual_size = size_binop (PLUS_EXPR, virtual_size, cookie_size);
}
- if (auto_delete_vec == sfk_deleting_destructor)
- deallocate_expr = build_op_delete_call (VEC_DELETE_EXPR,
- base_tbd, virtual_size,
- use_global_delete & 1,
- /*placement=*/NULL_TREE,
- /*alloc_fn=*/NULL_TREE);
+ deallocate_expr = build_op_delete_call (VEC_DELETE_EXPR,
+ base_tbd, virtual_size,
+ use_global_delete & 1,
+ /*placement=*/NULL_TREE,
+ /*alloc_fn=*/NULL_TREE);
}
body = loop;
@@ -3284,7 +3282,7 @@ build_vec_init (tree base, tree maxindex, tree init,
finish_cleanup_try_block (try_block);
e = build_vec_delete_1 (rval, m,
- inner_elt_type, sfk_base_destructor,
+ inner_elt_type, sfk_complete_destructor,
/*use_global_delete=*/0, complain);
if (e == error_mark_node)
errors = true;