On Sat, Oct 24, 2020 at 02:32:37AM +0300, Ville Voutilainen via Gcc-patches wrote: > Finishing testing on Linux-PPC64. Ok for trunk if tests pass? > > 2020-10-24 Ville Voutilainen <ville.voutilai...@gmail.com> > > gcc/c-family/ChangeLog: > > Implement __is_nothrow_{constructible,assignable} > * c-common.c (__is_nothrow_assignable): New. > (__is_nothrow_constructible): Likewise. > * c-common.h (RID_IS_NOTHROW_ASSIGNABLE): New. > (RID_IS_NOTHROW_CONSTRUCTIBLE): Likewise. > > gcc/cp/ChangeLog: > > Implement __is_nothrow_{constructible,assignable} > * cp-tree.h (CPTK_IS_NOTHROW_ASSIGNABLE): New. > (CPTK_IS_NOTHROW_CONSTRUCTIBLE): Likewise. > (is_nothrow_xible): Likewise. > * method.c (__is_nothrow_xible): New. > * parser.c (cp_parser_primary_expression): Handle the new RID_*. > (cp_parser_trait_expr): Likewise. > * semantics.c (trait_expr_value): Handle the new RID_*. > (finish_trait_expr): Likewise. > > libstdc++-v3/ChangeLog: > > Implement __is_nothrow_{constructible,assignable} > * include/std/type_traits (__is_nt_constructible_impl): Remove. > (__is_nothrow_constructible_impl): Adjust. > (is_nothrow_default_constructible): Likewise. > (__is_nt_assignable_impl): Remove. > (__is_nothrow_assignable_impl): Adjust.
> diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c > index e16ca3894bc..098a36e4d67 100644 > --- a/gcc/c-family/c-common.c > +++ b/gcc/c-family/c-common.c > @@ -527,6 +527,8 @@ const struct c_common_resword c_common_reswords[] = > { "while", RID_WHILE, 0 }, > { "__is_assignable", RID_IS_ASSIGNABLE, D_CXXONLY }, > { "__is_constructible", RID_IS_CONSTRUCTIBLE, D_CXXONLY }, > + { "__is_nothrow_assignable", RID_IS_NOTHROW_ASSIGNABLE, D_CXXONLY }, > + { "__is_nothrow_constructible", RID_IS_NOTHROW_CONSTRUCTIBLE, D_CXXONLY }, > > /* C++ transactional memory. */ > { "synchronized", RID_SYNCHRONIZED, D_CXX_OBJC | D_TRANSMEM }, > diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h > index 3d96092a297..24a4a8e7fe3 100644 > --- a/gcc/c-family/c-common.h > +++ b/gcc/c-family/c-common.h > @@ -176,6 +176,7 @@ enum rid > RID_IS_TRIVIALLY_COPYABLE, > RID_IS_UNION, RID_UNDERLYING_TYPE, > RID_IS_ASSIGNABLE, RID_IS_CONSTRUCTIBLE, > + RID_IS_NOTHROW_ASSIGNABLE, RID_IS_NOTHROW_CONSTRUCTIBLE, > > /* C++11 */ > RID_CONSTEXPR, RID_DECLTYPE, RID_NOEXCEPT, RID_NULLPTR, RID_STATIC_ASSERT, > diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h > index 5c06ac3789e..1ce20989e13 100644 > --- a/gcc/cp/cp-tree.h > +++ b/gcc/cp/cp-tree.h > @@ -1323,7 +1323,9 @@ enum cp_trait_kind > CPTK_IS_UNION, > CPTK_UNDERLYING_TYPE, > CPTK_IS_ASSIGNABLE, > - CPTK_IS_CONSTRUCTIBLE > + CPTK_IS_CONSTRUCTIBLE, > + CPTK_IS_NOTHROW_ASSIGNABLE, > + CPTK_IS_NOTHROW_CONSTRUCTIBLE > }; > > /* The types that we are processing. */ > @@ -6752,6 +6754,7 @@ extern void use_thunk (tree, > bool); > extern bool trivial_fn_p (tree); > extern tree forward_parm (tree); > extern bool is_trivially_xible (enum tree_code, tree, > tree); > +extern bool is_nothrow_xible (enum tree_code, tree, tree); > extern bool is_xible (enum tree_code, tree, tree); > extern tree get_defaulted_eh_spec (tree, tsubst_flags_t = > tf_warning_or_error); > extern bool maybe_explain_implicit_delete (tree); > diff --git a/gcc/cp/method.c b/gcc/cp/method.c > index 6e4c5f7e83b..2ffc86cbd81 100644 > --- a/gcc/cp/method.c > +++ b/gcc/cp/method.c > @@ -1933,6 +1933,21 @@ is_trivially_xible (enum tree_code code, tree to, tree > from) > return !nt; > } > > +/* Returns true iff TO is nothrow assignable (if CODE is MODIFY_EXPR) or > + constructible (otherwise) from FROM, which is a single type for > + assignment or a list of types for construction. */ > + > +bool > +is_nothrow_xible (enum tree_code code, tree to, tree from) > +{ > + tree expr; > + expr = is_xible_helper (code, to, from, /*trivial*/false); tree expr = is_xible_helper (code, to, from, /*trivial*/false); would be nicer, otherwise the front-end changes look fine, thanks. Marek