From patchwork Tue Mar 21 14:21:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 72897 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1808279wrt; Tue, 21 Mar 2023 07:24:09 -0700 (PDT) X-Google-Smtp-Source: AK7set8YOoT4Ce9AASB9EzUH3WS8z6x2TWtp+P9KAv8RpNfROQOIv9VNGvS773HLZxoznOmAapXl X-Received: by 2002:a17:906:a012:b0:92b:c56a:7efe with SMTP id p18-20020a170906a01200b0092bc56a7efemr3285045ejy.31.1679408648959; Tue, 21 Mar 2023 07:24:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679408648; cv=none; d=google.com; s=arc-20160816; b=ELx6mUqatSyR6th1o+U9i07u88lF20GZJ4N5IdbRVZec5U+ekwk6CCPsNnRF2K/tky HFVrrnN4KKFPA7QA3cgZWAelaHrqEbuNMZknSA69vpDVIIy6I+VnQqkeugX1ozq4iLxM aLX80GVBRSI6BzqnOo5Xeqnw5DBEPDomjNjxzASiAG7Th7SNDjE7Iy1Lhq6YR+HfWEpw RMy0hKJRR10LnlwFhGxnN3edRKWnuUYepXLtcp1CISafkGlGMyIXdZHC+f+377Y6iiTe MKCtM+3zcwgPcBjoOdskadqHsVNawqGzA7eOowokWsc+hlAKnDyN15h8JrEj77LOr0tc eTzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=qoSpra/myCdjsG2KbkLL4UjUjqt7pQjVkQGJgg0M93g=; b=s29tBMO1wP2fFb3oG02GRlXVXBLEJRQkH2E5scO0FlyH4iykDeW7x0pu4Z4ugnjPzD dWUXVELevI6B4+n1cORLZA0TEy1ovxSHb9vSVMuWyLMmOdce9cANpBq7A8vmbhmg8gH3 C4EeyLB5nOXUWSCcXtvhnTJams0DdYQvqOqqx3TEH0aONhwIsZHIfEgqJyFEehfp/AAP QziXad6PHAFp/9vt77k5TMJAheNn5I8G1gnvS0Cwl+XfX0ZUBwFpjg7yK/KhXziKLgwn FyKi+tX4kv/t6zf1WMct1lXoEU+I8ixW07uV4hYmHDUvZYN+lgug1A0oFiXzM9Pq3bY6 GLqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=KjY4wErn; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id go31-20020a1709070d9f00b0093999e387dcsi3394080ejc.84.2023.03.21.07.24.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Mar 2023 07:24:08 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=KjY4wErn; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 40D09385087E for ; Tue, 21 Mar 2023 14:23:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 40D09385087E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679408599; bh=qoSpra/myCdjsG2KbkLL4UjUjqt7pQjVkQGJgg0M93g=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=KjY4wErnjKJK2CKNmIkc8UyRXY+iovuQdfHJywz+5MrGLQR4AxYO2mhZednqxQV5N /k/gM+7ThcS5N+Wr2D1oHJ9xAtd+xRlnX1vOB/sUS0IkC/vLFKoF9ccojCGfQl/h1t DB0rU+VEW4QIuH5CKlJCIEZWDYad4Z894B9Nkp5g= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00641c01.pphosted.com (mx0a-00641c01.pphosted.com [205.220.165.146]) by sourceware.org (Postfix) with ESMTPS id B852A3858D37; Tue, 21 Mar 2023 14:22:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B852A3858D37 Received: from pps.filterd (m0247470.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32LEHeV9009188; Tue, 21 Mar 2023 14:22:29 GMT Received: from mxout23.cac.washington.edu (mxout23.cac.washington.edu [140.142.32.140]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3pevw8nhrb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Mar 2023 14:22:29 +0000 Received: from smtp.washington.edu (smtp.washington.edu [140.142.234.157]) by mxout23.cac.washington.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 32LEM6fH030864 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Mar 2023 07:22:06 -0700 X-Auth-Received: from localhost.localdomain ([10.154.74.245]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 32LEM5K8025267 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 21 Mar 2023 07:22:06 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, ppalka@redhat.com, Ken Matsui Subject: [PATCH 1/2] c++: implement __is_function built-in trait Date: Tue, 21 Mar 2023 07:21:58 -0700 Message-Id: <20230321142159.86694-1-kmatsui@cs.washington.edu> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Proofpoint-GUID: vNBCUNz0EKZ1EQ7gWn0LSh9-lDaX7maU X-Proofpoint-ORIG-GUID: vNBCUNz0EKZ1EQ7gWn0LSh9-lDaX7maU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-21_11,2023-03-21_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 suspectscore=0 phishscore=0 mlxlogscore=939 spamscore=0 clxscore=1015 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303210113 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ken Matsui via Gcc-patches From: Ken Matsui Reply-To: Ken Matsui Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760987603459114769?= X-GMAIL-MSGID: =?utf-8?q?1760987603459114769?= This patch implements built-in trait for std::is_function. gcc/cp/ChangeLog: * cp-trait.def: Define __is_function. * constraint.cc (diagnose_trait_expr): Handle CPTK_IS_FUNCTION. * semantics.cc (trait_expr_value): Likewise. (finish_trait_expr): Likewise. gcc/testsuite/ChangeLog: * g++.dg/ext/has-builtin-1.C: Test existence of __is_function. * g++.dg/ext/is_function.C: New test. --- gcc/cp/constraint.cc | 3 ++ gcc/cp/cp-trait.def | 1 + gcc/cp/semantics.cc | 4 ++ gcc/testsuite/g++.dg/ext/has-builtin-1.C | 3 ++ gcc/testsuite/g++.dg/ext/is_function.C | 55 ++++++++++++++++++++++++ 5 files changed, 66 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ext/is_function.C diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index 273d15ab097..313869152d0 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -3747,6 +3747,9 @@ diagnose_trait_expr (tree expr, tree args) case CPTK_IS_UNION: inform (loc, " %qT is not a union", t1); break; + case CPTK_IS_FUNCTION: + inform (loc, " %qT is not a function", t1); + break; case CPTK_IS_AGGREGATE: inform (loc, " %qT is not an aggregate", t1); break; diff --git a/gcc/cp/cp-trait.def b/gcc/cp/cp-trait.def index bac593c0094..28aed4d39bb 100644 --- a/gcc/cp/cp-trait.def +++ b/gcc/cp/cp-trait.def @@ -82,6 +82,7 @@ DEFTRAIT_EXPR (IS_TRIVIALLY_ASSIGNABLE, "__is_trivially_assignable", 2) DEFTRAIT_EXPR (IS_TRIVIALLY_CONSTRUCTIBLE, "__is_trivially_constructible", -1) DEFTRAIT_EXPR (IS_TRIVIALLY_COPYABLE, "__is_trivially_copyable", 1) DEFTRAIT_EXPR (IS_UNION, "__is_union", 1) +DEFTRAIT_EXPR (IS_FUNCTION, "__is_function", 1) DEFTRAIT_EXPR (REF_CONSTRUCTS_FROM_TEMPORARY, "__reference_constructs_from_temporary", 2) DEFTRAIT_EXPR (REF_CONVERTS_FROM_TEMPORARY, "__reference_converts_from_temporary", 2) /* FIXME Added space to avoid direct usage in GCC 13. */ diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index 87c2e8a7111..0b905d0c64b 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -11992,6 +11992,9 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2) case CPTK_IS_ENUM: return type_code1 == ENUMERAL_TYPE; + case CPTK_IS_FUNCTION: + return type_code1 == FUNCTION_TYPE; + case CPTK_IS_FINAL: return CLASS_TYPE_P (type1) && CLASSTYPE_FINAL (type1); @@ -12200,6 +12203,7 @@ finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2) case CPTK_IS_ENUM: case CPTK_IS_UNION: case CPTK_IS_SAME: + case CPTK_IS_FUNCTION: break; case CPTK_IS_LAYOUT_COMPATIBLE: diff --git a/gcc/testsuite/g++.dg/ext/has-builtin-1.C b/gcc/testsuite/g++.dg/ext/has-builtin-1.C index f343e153e56..452d2ccad4d 100644 --- a/gcc/testsuite/g++.dg/ext/has-builtin-1.C +++ b/gcc/testsuite/g++.dg/ext/has-builtin-1.C @@ -146,3 +146,6 @@ #if !__has_builtin (__remove_cvref) # error "__has_builtin (__remove_cvref) failed" #endif +#if !__has_builtin (__is_function) +# error "__has_builtin (__is_function) failed" +#endif diff --git a/gcc/testsuite/g++.dg/ext/is_function.C b/gcc/testsuite/g++.dg/ext/is_function.C new file mode 100644 index 00000000000..acd37800636 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/is_function.C @@ -0,0 +1,55 @@ +// { dg-do compile { target c++11 } } + +#include + +using namespace __gnu_test; + +#define SA(X) static_assert((X),#X) + +struct A +{ void fn(); }; + +template +struct AHolder { }; + +template +struct AHolder +{ using type = U; }; + +// Positive tests. +SA(__is_function(int (int))); +SA(__is_function(ClassType (ClassType))); +SA(__is_function(float (int, float, int[], int&))); +SA(__is_function(int (int, ...))); +SA(__is_function(bool (ClassType) const)); +SA(__is_function(AHolder::type)); + +void fn(); +SA(__is_function(decltype(fn))); + +// Negative tests. +SA(!__is_function(int)); +SA(!__is_function(int*)); +SA(!__is_function(int&)); +SA(!__is_function(void)); +SA(!__is_function(const void)); +SA(!__is_function(void*)); +SA(!__is_function(const void*)); +SA(!__is_function(void**)); +SA(!__is_function(std::nullptr_t)); + +SA(!__is_function(AbstractClass)); +SA(!__is_function(int(&)(int))); +SA(!__is_function(int(*)(int))); + +SA(!__is_function(A)); +SA(!__is_function(decltype(&A::fn))); + +struct FnCallOverload +{ void operator()(); }; +SA(!__is_function(FnCallOverload)); + +// Sanity check. +SA(!__is_function(ClassType)); +SA(!__is_function(IncompleteClass)); +SA(!__is_function(IncompleteUnion)); From patchwork Tue Mar 21 14:21:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 72901 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1808775wrt; Tue, 21 Mar 2023 07:25:03 -0700 (PDT) X-Google-Smtp-Source: AK7set/rnleipq5R+be3Np5y2vD/dcy5KPp3c88iXO3GJyon7CMQUjC/sRJpHltsOwwANOmOOf/3 X-Received: by 2002:a17:906:6c84:b0:88d:ba89:1837 with SMTP id s4-20020a1709066c8400b0088dba891837mr14219424ejr.8.1679408703749; Tue, 21 Mar 2023 07:25:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679408703; cv=none; d=google.com; s=arc-20160816; b=OjjkeAupuc4m3oW8t1nSYjO3QMOL2UzGdYM2ZI4BVFX8ObQQiVd9l+Szt/9TqPVBmW S09Lzvm0ao/Kv1A1tPqj3g5ck3UuLNhVh0EkSM0XGMOzFklcTUetNtvWWx5ghg0tkDCK dp1K+CmAXmgpKFPvGwcIQGMSf7lkgBNDkHKeyd57VBGb++JHJTXi8F+GKOFMW9F7WW9C MOPZ3+c3+IFNKkpN2MRSA5lAiE9x6k2yn/Y3exC1Gbo+UnG78FD0Xbj7+RRzpkHzJ++M RGBCZTtI/isqIzjIN0o2fWANU0cKtCrmb1Kp6lK3TyGA5Qbk74f5uBJiovtnWptj84Dd 9YSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=vCIQVJzzSdSSvGUDRqHAxFPmJQ8lHwfX2MVuRciW7gk=; b=hoL5OCtr62Payxo+rGi6LpZgflOB3WakUc+DbKh7I+wrfJxX7uld4hpJpkEhoruftF ZksFq+5gHGII+ZYyxsZCXAJKJY40bL4NiDMKok8ObKh2CGJ4meDOWtX6kBCdUYIm5JrU HfjE/wK/cJJEGwpntKqu8odwJJB0LtE1aXxDBit6twFPk1ZTrgySmLGtfJsgMV9S9bQO k4BVRf4L5SI5OSmbkaNTsL11ApvqAmsQ7EDikvK0LgcTZS7r8GsPF+b+DjjLLMkf0WuA Nxp50E1Whe83OMG1XJ+4MGXbP1WYBiEUzsAcwJBbPg+PW4Ag0qKTC7V0314mKImDLWuW 1XiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=JsfPk96Z; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id x12-20020a170906134c00b0093138e5a851si13017099ejb.344.2023.03.21.07.25.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Mar 2023 07:25:03 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=JsfPk96Z; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 277653850233 for ; Tue, 21 Mar 2023 14:24:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 277653850233 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679408657; bh=vCIQVJzzSdSSvGUDRqHAxFPmJQ8lHwfX2MVuRciW7gk=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=JsfPk96ZQXS9rmiVJjZt+4YrK4081ACGZIpn5EeEXS32cSjewf9qdlBWFf1t8TI0b RZ0RU0ndyOu5GpQZJFhOXKCp5ayCM2+g7Uo4inySIHOdyqHqHHiWB7rq6BS5GVfKbC AE7oZdtFrxFD4RaFJhMt//Dnsp+MtQVQrjM6P5Ak= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00641c01.pphosted.com (mx0a-00641c01.pphosted.com [205.220.165.146]) by sourceware.org (Postfix) with ESMTPS id DD4623858D38; Tue, 21 Mar 2023 14:22:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DD4623858D38 Received: from pps.filterd (m0247472.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32LEK6vU005597; Tue, 21 Mar 2023 14:22:32 GMT Received: from mxout21.s.uw.edu (mxout21.s.uw.edu [140.142.32.139]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3pf0g8krvx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 21 Mar 2023 14:22:31 +0000 Received: from smtp.washington.edu (smtp.washington.edu [140.142.234.157]) by mxout21.s.uw.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 32LEMDxg029740 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Mar 2023 07:22:13 -0700 X-Auth-Received: from localhost.localdomain ([10.154.74.245]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 32LEM5K9025267 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 21 Mar 2023 07:22:13 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, ppalka@redhat.com, Ken Matsui Subject: [PATCH 2/2] libstdc++: use new built-in trait __is_function Date: Tue, 21 Mar 2023 07:21:59 -0700 Message-Id: <20230321142159.86694-2-kmatsui@cs.washington.edu> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230321142159.86694-1-kmatsui@cs.washington.edu> References: <20230321142159.86694-1-kmatsui@cs.washington.edu> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: VBqqI0SEEQvbBoFfoT4OfwNrbK591zFj X-Proofpoint-GUID: VBqqI0SEEQvbBoFfoT4OfwNrbK591zFj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-21_11,2023-03-21_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 bulkscore=0 spamscore=0 priorityscore=1501 malwarescore=0 mlxlogscore=867 adultscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303210113 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ken Matsui via Gcc-patches From: Ken Matsui Reply-To: Ken Matsui Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760987660855636373?= X-GMAIL-MSGID: =?utf-8?q?1760987660855636373?= This patch lets libstdc++ use new built-in trait __is_function. libstdc++-v3/ChangeLog: * include/std/type_traits (is_function): Use __is_function built-in trait. --- libstdc++-v3/include/std/type_traits | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 2bd607a8b8f..d008d5eb67d 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -594,6 +594,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; /// is_function +#if __has_builtin(__is_function) + template + struct is_function + : public __bool_constant<__is_function(_Tp)> + { }; +#else template struct is_function : public __bool_constant::value> { }; @@ -605,6 +611,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct is_function<_Tp&&> : public false_type { }; +#endif #define __cpp_lib_is_null_pointer 201309L