diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2024-03-19 14:02:06 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2024-03-22 22:37:57 +0000 |
commit | 31ef58b18da930b09ea0dfc1d6533c5ef97d8446 (patch) | |
tree | 3b94ce9194338577698157a6ad4e8ca8bbb07bb3 /libstdc++-v3/include | |
parent | c083a453dbe51853e26e02edd8b9346fb8618292 (diff) | |
download | gcc-31ef58b18da930b09ea0dfc1d6533c5ef97d8446.zip gcc-31ef58b18da930b09ea0dfc1d6533c5ef97d8446.tar.gz gcc-31ef58b18da930b09ea0dfc1d6533c5ef97d8446.tar.bz2 |
libstdc++: Replace std::result_of with __invoke_result_t [PR114394]
Replace std::result_of with std::invoke_result, as specified in the
standard since C++17, to avoid deprecated warnings for std::result_of.
We don't have __invoke_result_t in C++11 mode, so add it as an alias
template for __invoke_result<>::type (which is what std::result_of uses
as its base class, so there's no change in functionality).
This fixes warnings given by Clang 18.
libstdc++-v3/ChangeLog:
PR libstdc++/114394
* include/std/functional (bind): Use __invoke_result_t instead
of result_of::type.
* include/std/type_traits (__invoke_result_t): New alias
template.
* testsuite/20_util/bind/ref_neg.cc: Adjust prune pattern.
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r-- | libstdc++-v3/include/std/functional | 2 | ||||
-rw-r--r-- | libstdc++-v3/include/std/type_traits | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index e02be00..766558b 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -556,7 +556,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Fn, typename _CallArgs, typename... _BArgs> using _Res_type_impl - = typename result_of< _Fn&(_Mu_type<_BArgs, _CallArgs>&&...) >::type; + = __invoke_result_t<_Fn&, _Mu_type<_BArgs, _CallArgs>&&...>; template<typename _CallArgs> using _Res_type = _Res_type_impl<_Functor, _CallArgs, _Bound_args...>; diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 21402fd..b441bf9 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -2664,6 +2664,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Functor, _ArgTypes... >::type { }; + + // __invoke_result_t (std::invoke_result_t for C++11) + template<typename _Fn, typename... _Args> + using __invoke_result_t = typename __invoke_result<_Fn, _Args...>::type; /// @endcond template<typename _Functor, typename... _ArgTypes> |