From 7574e4584518301fca1c3b088063e63964001f53 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Mon, 8 May 2017 16:58:44 +0000 Subject: [PATCH] class.c (build_vtbl_initializer): Don't shadow outer variable with static var. * class.c (build_vtbl_initializer): Don't shadow outer variable with static var. From-SVN: r247747 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/class.c | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2538783f2c1..05f8fa8364e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2017-05-08 Nathan Sidwell + * class.c (build_vtbl_initializer): Don't shadow outer variable + with static var. + Revert _binding -> _value change. * name-lookup.h (get_namespace_value, set_global_value): Rename to ... (get_namespace_binding, set_global_binding): ... these. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 945406e8bdb..9b996e325a0 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -9769,18 +9769,19 @@ build_vtbl_initializer (tree binfo, /* Likewise for deleted virtuals. */ else if (DECL_DELETED_FN (fn_original)) { - static tree fn; + static tree dvirt_fn; - if (!fn) + if (!dvirt_fn) { tree name = get_identifier ("__cxa_deleted_virtual"); - fn = IDENTIFIER_GLOBAL_VALUE (name); - if (!fn) - fn = push_library_fn + dvirt_fn = IDENTIFIER_GLOBAL_VALUE (name); + if (!dvirt_fn) + dvirt_fn = push_library_fn (name, build_function_type_list (void_type_node, NULL_TREE), NULL_TREE, ECF_NORETURN); } + fn = dvirt_fn; if (!TARGET_VTABLE_USES_DESCRIPTORS) init = fold_convert (vfunc_ptr_type_node, build_fold_addr_expr (fn)); @@ -9789,7 +9790,8 @@ build_vtbl_initializer (tree binfo, { if (!integer_zerop (delta) || vcall_index) { - fn = make_thunk (fn, /*this_adjusting=*/1, delta, vcall_index); + fn = make_thunk (fn, /*this_adjusting=*/1, + delta, vcall_index); if (!DECL_NAME (fn)) finish_thunk (fn); } -- 2.30.2