From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 0A6C03858D32 for ; Fri, 22 Mar 2024 22:45:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0A6C03858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0A6C03858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711147505; cv=none; b=JMWE1HxMbr8fXCY6IW9MvvxgtEBQn5vFf9tVRK+57UfNWJ2QWV7C5L5fISbhZsXUPt8/7b+DxLtgGXAWjjig5iKSOef1zMfEGtXfn3RHMmp4mPBXbAsj2kDsb+lf2SjsWiGb2lrgdqMPSaLLOSPyT2tjZCkOq5f9V1TGki5S0gk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711147505; c=relaxed/simple; bh=FD6ycVftt1KUu4TqH/ugyxfU9B1Qq8gguDp+yltN2Fo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=q6bQampMOnxSFhym2jt2n1OtHIHUcV2vstZebE5Zr9gIyJLSQ3phYS3CM0eFCdkzzpcl814CftGMC6ggT4WPn8wgrvNnFy5l/IL5hfN+HlTXMqk2HiJnVsDPrimwNR+m4i5ezRuUbwSnaSsm9S8o8w1F3vgWrMkW3SH4EtQGTGA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711147503; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=31EGh7qgEXWM3d3+nLhlf+0tEJpTTD8NL2g3x76Svh4=; b=V+gY9mjkGRh65BQae3Na6fXmdtf2TGyeYG/rcFmzIDCaeAoCE16EMRR51AcrgDyoa1LFgn YYZkW9bDXboncpaFzG53EcYQ1r4uGqW39GQsqkCSYsOm/JZAp8wXfLtkARycQMrb7wUaIb 9PwnFhkeL9LGHZR7mPRx3CKe49RhDbI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-639-0ZzhZr4gPQa0BpE9usLZhA-1; Fri, 22 Mar 2024 18:45:02 -0400 X-MC-Unique: 0ZzhZr4gPQa0BpE9usLZhA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B8B25101A523; Fri, 22 Mar 2024 22:45:01 +0000 (UTC) Received: from localhost (unknown [10.42.28.188]) by smtp.corp.redhat.com (Postfix) with ESMTP id 86082492BD0; Fri, 22 Mar 2024 22:45:01 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Replace std::result_of with __invoke_result_t [PR114394] Date: Fri, 22 Mar 2024 22:44:34 +0000 Message-ID: <20240322224456.368452-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tested aarch64-linux. Pushed to trunk. -- >8 -- 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. --- 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() { -- 2.44.0