diff options
author | Jason Merrill <jason@redhat.com> | 2016-11-07 18:09:29 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2016-11-07 18:09:29 -0500 |
commit | 51dc660315ef83dcb907f3bd3a0a56abb9efed7a (patch) | |
tree | c9f9278ab8d390747f291ff0e7146959604797d2 /libstdc++-v3/libsupc++ | |
parent | 452811eb53e9c0457f99f4f23a4ca10354c088e1 (diff) | |
download | gcc-51dc660315ef83dcb907f3bd3a0a56abb9efed7a.zip gcc-51dc660315ef83dcb907f3bd3a0a56abb9efed7a.tar.gz gcc-51dc660315ef83dcb907f3bd3a0a56abb9efed7a.tar.bz2 |
Implement P0012R1, Make exception specifications part of the type system.
gcc/cp/
* cp-tree.h (enum tsubst_flags): Add tf_fndecl_type.
(flag_noexcept_type, ce_type): New.
* call.c (build_conv): Add ck_fnptr.
(enum conversion_kind): Change ck_tsafe to ck_fnptr.
(convert_like_real): Likewise.
(standard_conversion): Likewise. Allow function pointer
conversions for pointers to member functions.
(reference_compatible_p): Allow function pointer conversions.
(direct_reference_binding): Likewise.
(reference_binding): Reference-compatible is no longer a subset of
reference-related.
(is_subseq): Also strip ck_lvalue after next_conversion.
* class.c (instantiate_type): Check fnptr_conv_p.
(resolve_address_of_overloaded_function): Likewise.
* cvt.c (can_convert_tx_safety): Now static.
(noexcept_conv_p, fnptr_conv_p, strip_fnptr_conv): New.
* decl.c (flag_noexcept_type): Define.
(cxx_init_decl_processing): Set it.
(bad_specifiers): Check it.
(grokdeclarator) [cdk_function]: Add exception-spec to type here.
* lambda.c (maybe_add_lambda_conv_op): Add exception-spec to
returned pointer.
* mangle.c (struct globals): Add need_cxx1z_warning.
(mangle_decl): Check it.
(write_exception_spec): New.
(write_function_type): Call it.
(canonicalize_for_substitution): Handle exception spec.
(write_type): Likewise.
(write_encoding): Set processing_template_decl across mangling of
partially-instantiated type.
* pt.c (determine_specialization): Pass tf_fndecl_type.
(tsubst_decl, fn_type_unification): Likewise.
(tsubst): Strip tf_fndecl_type, pass it to
tsubst_exception_specification.
(convert_nontype_argument_function): Handle function pointer
conversion.
(convert_nontype_argument): Likewise.
(unify, for_each_template_parm_r): Walk into noexcept-specifier.
* rtti.c (ptr_initializer): Encode noexcept.
* tree.c (canonical_eh_spec): New.
(build_exception_variant): Use it.
* typeck.c (composite_pointer_type): Handle fnptr conversion.
(comp_except_specs): Compare canonical EH specs.
(structural_comptypes): Call it.
gcc/c-family/
* c.opt (Wc++1z-compat): New.
* c-cppbuiltin.c (c_cpp_builtins): Add __cpp_noexcept_function_type.
libstdc++-v3/
* include/bits/c++config (_GLIBCXX_NOEXCEPT_PARM)
(_GLIBCXX_NOEXCEPT_QUAL): New.
* include/std/type_traits (is_function): Use them.
* libsubc++/new (launder): Likewise.
* libsupc++/cxxabi.h (__pbase_type_info::__masks): Add
__noexcept_mask.
* libsupc++/pbase_type_info.cc (__do_catch): Handle function
pointer conversion.
libiberty/
* cp-demangle.c (is_fnqual_component_type): New.
(d_encoding, d_print_comp_inner, d_print_mod_list): Use it.
(FNQUAL_COMPONENT_CASE): New.
(d_make_comp, has_return_type, d_print_comp_inner)
(d_print_function_type): Use it.
(next_is_type_qual): New.
(d_cv_qualifiers, d_print_mod): Handle noexcept and throw-spec.
include/
* demangle.h (enum demangle_component_type): Add
DEMANGLE_COMPONENT_NOEXCEPT, DEMANGLE_COMPONENT_THROW_SPEC.
From-SVN: r241944
Diffstat (limited to 'libstdc++-v3/libsupc++')
-rw-r--r-- | libstdc++-v3/libsupc++/cxxabi.h | 3 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/new | 8 | ||||
-rw-r--r-- | libstdc++-v3/libsupc++/pbase_type_info.cc | 13 |
3 files changed, 13 insertions, 11 deletions
diff --git a/libstdc++-v3/libsupc++/cxxabi.h b/libstdc++-v3/libsupc++/cxxabi.h index f4b8f75..7f1bd99 100644 --- a/libstdc++-v3/libsupc++/cxxabi.h +++ b/libstdc++-v3/libsupc++/cxxabi.h @@ -279,7 +279,8 @@ namespace __cxxabiv1 __restrict_mask = 0x4, __incomplete_mask = 0x8, __incomplete_class_mask = 0x10, - __transaction_safe_mask = 0x20 + __transaction_safe_mask = 0x20, + __noexcept_mask = 0x40 }; protected: diff --git a/libstdc++-v3/libsupc++/new b/libstdc++-v3/libsupc++/new index 6bc6c00..1e59649 100644 --- a/libstdc++-v3/libsupc++/new +++ b/libstdc++-v3/libsupc++/new @@ -197,10 +197,10 @@ namespace std // The program is ill-formed if T is a function type or // (possibly cv-qualified) void. - template<typename _Ret, typename... _Args> - void launder(_Ret (*)(_Args...)) = delete; - template<typename _Ret, typename... _Args> - void launder(_Ret (*)(_Args......)) = delete; + template<typename _Ret, typename... _Args _GLIBCXX_NOEXCEPT_PARM> + void launder(_Ret (*)(_Args...) _GLIBCXX_NOEXCEPT_QUAL) = delete; + template<typename _Ret, typename... _Args _GLIBCXX_NOEXCEPT_PARM> + void launder(_Ret (*)(_Args......) _GLIBCXX_NOEXCEPT_QUAL) = delete; void launder(void*) = delete; void launder(const void*) = delete; diff --git a/libstdc++-v3/libsupc++/pbase_type_info.cc b/libstdc++-v3/libsupc++/pbase_type_info.cc index ff6b756..b2b9c09 100644 --- a/libstdc++-v3/libsupc++/pbase_type_info.cc +++ b/libstdc++-v3/libsupc++/pbase_type_info.cc @@ -80,12 +80,13 @@ __do_catch (const type_info *thr_type, unsigned tflags = thrown_type->__flags; - bool throw_tx = (tflags & __transaction_safe_mask); - bool catch_tx = (__flags & __transaction_safe_mask); - if (throw_tx && !catch_tx) - /* Catch can perform a transaction-safety conversion. */ - tflags &= ~__transaction_safe_mask; - if (catch_tx && !throw_tx) + const unsigned fqual_mask = __transaction_safe_mask|__noexcept_mask; + unsigned throw_fqual = (tflags & fqual_mask); + unsigned catch_fqual = (__flags & fqual_mask); + if (throw_fqual & ~catch_fqual) + /* Catch can perform a function pointer conversion. */ + tflags &= catch_fqual; + if (catch_fqual & ~throw_fqual) /* But not the reverse. */ return false; |