diff options
author | Jason Merrill <jason@redhat.com> | 2014-03-26 12:50:26 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2014-03-26 12:50:26 -0400 |
commit | d74db8ff1c8f126c3d45ab9e72458ead0422865b (patch) | |
tree | 50d4baaeda9834b83184bd2181f60f3b85f9f5b8 /gcc/cp/class.c | |
parent | 3a2700f61bd54868e8572b18f3dadf994adb45ea (diff) | |
download | gcc-d74db8ff1c8f126c3d45ab9e72458ead0422865b.zip gcc-d74db8ff1c8f126c3d45ab9e72458ead0422865b.tar.gz gcc-d74db8ff1c8f126c3d45ab9e72458ead0422865b.tar.bz2 |
re PR c++/60566 (r208573 omits needed thunks)
PR c++/60566
PR c++/58678
* class.c (build_vtbl_initializer): Handle abstract dtors here.
* search.c (get_pure_virtuals): Not here.
From-SVN: r208845
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index b46391b..d277e07 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -9017,6 +9017,16 @@ build_vtbl_initializer (tree binfo, if (!TARGET_VTABLE_USES_DESCRIPTORS) init = fold_convert (vfunc_ptr_type_node, build_fold_addr_expr (fn)); + /* Don't refer to a virtual destructor from a constructor + vtable or a vtable for an abstract class, since destroying + an object under construction is undefined behavior and we + don't want it to be considered a candidate for speculative + devirtualization. But do create the thunk for ABI + compliance. */ + if (DECL_DESTRUCTOR_P (fn_original) + && (CLASSTYPE_PURE_VIRTUALS (DECL_CONTEXT (fn_original)) + || orig_binfo != binfo)) + init = size_zero_node; } } |