diff options
author | Ken Matsui <kmatsui@gcc.gnu.org> | 2024-02-21 00:49:10 -0800 |
---|---|---|
committer | Ken Matsui <kmatsui@gcc.gnu.org> | 2024-06-13 05:57:01 -0700 |
commit | 3060e9230264d60be349414285c361b7d32f233c (patch) | |
tree | fcf0335be5b78a325bd7b92ba15a8921db51f376 | |
parent | dbb26feeb67d033d9dff51042044997aa5db9226 (diff) | |
download | gcc-3060e9230264d60be349414285c361b7d32f233c.zip gcc-3060e9230264d60be349414285c361b7d32f233c.tar.gz gcc-3060e9230264d60be349414285c361b7d32f233c.tar.bz2 |
libstdc++: Optimize std::is_nothrow_invocable compilation performance
This patch optimizes the compilation performance of
std::is_nothrow_invocable by dispatching to the new
__is_nothrow_invocable built-in trait.
libstdc++-v3/ChangeLog:
* include/std/type_traits (is_nothrow_invocable): Use
__is_nothrow_invocable built-in trait.
* testsuite/20_util/is_nothrow_invocable/incomplete_args_neg.cc:
Handle the new error from __is_nothrow_invocable.
* testsuite/20_util/is_nothrow_invocable/incomplete_neg.cc:
Likewise.
Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
3 files changed, 6 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index fcaff88..8c8219b 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -3231,8 +3231,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// std::is_nothrow_invocable template<typename _Fn, typename... _ArgTypes> struct is_nothrow_invocable +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_nothrow_invocable) + : public __bool_constant<__is_nothrow_invocable(_Fn, _ArgTypes...)> +#else : __and_<__is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void>, __call_is_nothrow_<_Fn, _ArgTypes...>>::type +#endif { static_assert(std::__is_complete_or_unbounded(__type_identity<_Fn>{}), "_Fn must be a complete class or an unbounded array"); diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplete_args_neg.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplete_args_neg.cc index 3c22588..3f8542d 100644 --- a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplete_args_neg.cc +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplete_args_neg.cc @@ -18,6 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-error "must be a complete class" "" { target *-*-* } 0 } +// { dg-prune-output "invalid use of incomplete type" } #include <type_traits> diff --git a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplete_neg.cc b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplete_neg.cc index 5a728bf..d3bdf08 100644 --- a/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplete_neg.cc +++ b/libstdc++-v3/testsuite/20_util/is_nothrow_invocable/incomplete_neg.cc @@ -18,6 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-error "must be a complete class" "" { target *-*-* } 0 } +// { dg-prune-output "invalid use of incomplete type" } #include <type_traits> |