From patchwork Fri Mar 22 22:44:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1915081 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Aj9Qij+e; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V1cqR6gMNz1yXr for ; Sat, 23 Mar 2024 09:45:37 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 94E973858435 for ; Fri, 22 Mar 2024 22:45:35 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 88CB03858C32 for ; Fri, 22 Mar 2024 22:45:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 88CB03858C32 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 88CB03858C32 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=1711147508; cv=none; b=P8SnhNIvRRr8gcP+7+hWGTEBwVWyFm5TObQCBWUW4PiM3qjaXSVydNgS9t4ufxdLGWJs/01d9Wlwbo8wqn438BgyWIcXQAtJ09TCR3yc+Muf3UOKpGb7WgAXjAPvUglD3oVd+BVaZIljopzDrtONEZNT9JKM3GO1Xr0t75w4aNQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711147508; c=relaxed/simple; bh=FD6ycVftt1KUu4TqH/ugyxfU9B1Qq8gguDp+yltN2Fo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Osu2/iAfdDhWTvwX3AYoyuxCWbZ2MoZsvsL/FnYm7FmzgDgJPhFGaRVsGw517gNnhnsfsCj95naf0lL0evuYDWIzv5On9xHQcDy3u3sMxNsBwxTAK63wMARv391Rl8mNG1PUJBzyTwl87Ajdisqu66eHdiT0v+y9DtwJCxCqhus= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711147505; 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=Aj9Qij+eAEHTwFophTpHsqNMNGMX0NieuQ9Ox2kAnCL/EtpDx4/jjN7FAyI2ON5DOFNYs1 tA9A5WscLRjavAFq9Vy7RRiKdat9QeEatmVVVfrKmhNKec0jFV0afWfvJYZu+7nEFQK6yP IBd0QPmRITAasCIt1KRkdEwa2pdKSrk= 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 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=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org 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() {