From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id DC7CE3858D1E; Fri, 22 Mar 2024 22:44:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DC7CE3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711147473; bh=aSR7C30GzfEE992ZchTXF7FsC8h2JokUUbnGHcBIsVI=; h=From:To:Subject:Date:From; b=NZK8EhSQ9wRDsi8SQ/caChrfkf0gxDbpLtsZjOTveP2KOPR9Rwl+arVJa9xa7p7GJ yoqOiOc97rsiHCk+EGQtUd7UqeiIMf6kMmPKSG15UfxharoOykCKdDMSUoSUt7F3cd TxHoW91EKmLXdUsDNt7JaEhBYDEBc4JJc6gVHyDw= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-9632] libstdc++: Replace std::result_of with __invoke_result_t [PR114394] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: c083a453dbe51853e26e02edd8b9346fb8618292 X-Git-Newrev: 31ef58b18da930b09ea0dfc1d6533c5ef97d8446 Message-Id: <20240322224433.DC7CE3858D1E@sourceware.org> Date: Fri, 22 Mar 2024 22:44:33 +0000 (GMT) List-Id: https://gcc.gnu.org/g:31ef58b18da930b09ea0dfc1d6533c5ef97d8446 commit r14-9632-g31ef58b18da930b09ea0dfc1d6533c5ef97d8446 Author: Jonathan Wakely Date: Tue Mar 19 14:02:06 2024 +0000 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. Diff: --- libstdc++-v3/include/std/functional | 2 +- libstdc++-v3/include/std/type_traits | 4 ++++ libstdc++-v3/testsuite/20_util/bind/ref_neg.cc | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index e02be00abe5..766558b3ce0 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -556,7 +556,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template using _Res_type_impl - = typename result_of< _Fn&(_Mu_type<_BArgs, _CallArgs>&&...) >::type; + = __invoke_result_t<_Fn&, _Mu_type<_BArgs, _CallArgs>&&...>; template 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 21402fd8c13..b441bf9908f 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 + using __invoke_result_t = typename __invoke_result<_Fn, _Args...>::type; /// @endcond template diff --git a/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc b/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc index 4a1ed8dda5f..2db9fa8276a 100644 --- a/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc +++ b/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc @@ -50,7 +50,7 @@ void test02() // Ignore the reasons for deduction/substitution failure in the headers. // Arrange for the match to work on installed trees as well as build trees. -// { dg-prune-output "no type named 'type' in 'struct std::result_of" } +// { dg-prune-output "no type named 'type' in 'struct std::__invoke_result" } int main() {