diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-23 18:08:56 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-23 18:08:56 +0000 |
commit | 575852de8ed603167e75e5a85619f5e3877212d2 (patch) | |
tree | 42c2ea99646dafa555892877e4e1670084770361 /gcc/cp/except.c | |
parent | 72e2e4e0f7291e767f28083443b2d11f3a25aa77 (diff) | |
download | linaro-gcc-575852de8ed603167e75e5a85619f5e3877212d2.tar.gz linaro-gcc-575852de8ed603167e75e5a85619f5e3877212d2.tar.bz2 linaro-gcc-575852de8ed603167e75e5a85619f5e3877212d2.zip |
In C++11 a trivial [cd]tor might not be callable.
* class.c (user_provided_p): A function deleted on its declation
in the class is not user-provided.
(type_build_ctor_call): Also force a ctor call if we
might have a deleted or private trivial ctor.
(type_build_dtor_call): New.
(deduce_noexcept_on_destructors): Remove obsolete code.
* cp-tree.h: Declare type_build_dtor_call.
* decl.c (expand_static_init): Make sure trivial dtors are callable.
(cxx_maybe_build_cleanup): Likewise.
* except.c (build_throw): Likewise.
* init.c (build_value_init): Handle trivial but not callable ctors.
(perform_target_ctor): Make sure trivial dtor is callable.
(perform_member_init): Likewise.
(expand_cleanup_for_base): Likewise.
(build_vec_delete_1): Likewise.
(build_delete): Likewise.
(push_base_cleanups): Likewise.
(build_new_1): Avoid redundant error.
* method.c (synthesized_method_walk): Can't ever exit early in C++11.
Always process the subobject destructor.
* semantics.c (finish_compound_literal): Make sure trivial dtor is
callable.
* typeck2.c (split_nonconstant_init): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203985 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/except.c')
-rw-r--r-- | gcc/cp/except.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/gcc/cp/except.c b/gcc/cp/except.c index c76d9440aa9..daac0fde7e6 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -868,17 +868,21 @@ build_throw (tree exp) throw_type = build_eh_type_type (prepare_eh_type (TREE_TYPE (object))); - if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (object))) + cleanup = NULL_TREE; + if (type_build_dtor_call (TREE_TYPE (object))) { - cleanup = lookup_fnfields (TYPE_BINFO (TREE_TYPE (object)), + tree fn = lookup_fnfields (TYPE_BINFO (TREE_TYPE (object)), complete_dtor_identifier, 0); - cleanup = BASELINK_FUNCTIONS (cleanup); - mark_used (cleanup); - cxx_mark_addressable (cleanup); - /* Pretend it's a normal function. */ - cleanup = build1 (ADDR_EXPR, cleanup_type, cleanup); + fn = BASELINK_FUNCTIONS (fn); + mark_used (fn); + if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (object))) + { + cxx_mark_addressable (fn); + /* Pretend it's a normal function. */ + cleanup = build1 (ADDR_EXPR, cleanup_type, fn); + } } - else + if (cleanup == NULL_TREE) cleanup = build_int_cst (cleanup_type, 0); /* ??? Indicate that this function call throws throw_type. */ |