Message ID | 20220929115423.2725537-1-jwakely@redhat.com |
---|---|
State | New, archived |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f2ce:0:0:0:0:0 with SMTP id d14csp646918wrp; Thu, 29 Sep 2022 04:55:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM767Bmamepiql/fd2KpRKVFDoSMMCnJzH27OBsYGySQjQEakFKkw6xeOV13uO7KxQ8f33Mo X-Received: by 2002:a05:6402:3887:b0:458:289e:c9cc with SMTP id fd7-20020a056402388700b00458289ec9ccmr2316006edb.101.1664452511101; Thu, 29 Sep 2022 04:55:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664452511; cv=none; d=google.com; s=arc-20160816; b=X5mc2xKfKv1pqb927fcgD6lrmXrkzgIqllJz0uycHbyATHRnAWhZmCcMVFj9K6MOHB cGzBL/d26EJjFsP53ZAMhR7oI4gHNsFIf1W10MZnA5J3LL3H4JFYrPN15nzleQY8W5WC Yhw8Gl1VM8IDbizon5WuZQ2OzqCzbJIp9yBSZJ+6LT/qvk3xTJrB/hnCaeXvTqXbnLND DDl+Cevn0XQPk1plLuad9A4fwxp0OTwsj0IMFApN+Gp+1F1FrMVRy8RytP3GFnh3Nj1N G1ymeyQk1t3qUCHyE3pIv8Ya6NBx5jtMg2OUW99/SfpEldXU/lpQjdnh73ZhGlecDGmN SXxQ== 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:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=9YDsJeDqH9xWhgrP4D9z1JF0J32ejkYf98M2MXlixqg=; b=wzYcNSCO9IZlM3J/s5gmqWUiDeKRbFXaVpebRykHUDybfkp8lvpRGjdYCP4XJzdBT/ h/ZUGOOas1ft1FCXoUANUKENnGEy6L4cAx43GW/X7ySahJAKCxUWc5/JLS6VwjUHPzbZ ae0gEhjUjqFJGAoW88s0CHf8wOKgIYq2z/HNLvVjT9IaBKgENrDwKecUc2UGxI2d1nFI a7cSNgvobUqr+jfHfb5I0vTNHLv0PxN/ZoUeVVZ3ewH3gHZ1WUPL5G+9zaSHRk4YakdU hVjNZoyAPguI41ibglRbJpQ/dDpkuJrj6IL/JknPlskqQM/mcOay0KOyDIB/u08WD8p4 4O8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=PDWUCJw4; 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 jr22-20020a170906a99600b007470b52f94esi6409093ejb.199.2022.09.29.04.55.10 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 04:55:11 -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=PDWUCJw4; 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 E42E63858415 for <ouuuleilei@gmail.com>; Thu, 29 Sep 2022 11:55:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E42E63858415 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664452509; bh=9YDsJeDqH9xWhgrP4D9z1JF0J32ejkYf98M2MXlixqg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=PDWUCJw4+TNPzQX6A4kpp0+La4qdFzipGmJ3ZBPC9MfLsXc6tSYUvgaXopaNyat/k K4T4APSJx4WHGei+yk34vFtX8NSS7ldQUK35sIgOxR/usV9ghf1Wp+LstI84onlyj6 emKsveyazJEjQ0tq5FeOqcWenRDDhGlkSB+iA2l0= 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 DD4C43858D28 for <gcc-patches@gcc.gnu.org>; Thu, 29 Sep 2022 11:54:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DD4C43858D28 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-655-oQ8L02WqPOKXbn05tLpfbg-1; Thu, 29 Sep 2022 07:54:25 -0400 X-MC-Unique: oQ8L02WqPOKXbn05tLpfbg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F3A9E185A7AC; Thu, 29 Sep 2022 11:54:24 +0000 (UTC) Received: from localhost (unknown [10.33.36.214]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC0931400C39; Thu, 29 Sep 2022 11:54:24 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Guard use of new built-in with __has_builtin Date: Thu, 29 Sep 2022 12:54:23 +0100 Message-Id: <20220929115423.2725537-1-jwakely@redhat.com> In-Reply-To: <20220928233554.2670010-1-jwakely@redhat.com> References: <20220928233554.2670010-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.4 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_LOW, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Jonathan Wakely via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Jonathan Wakely <jwakely@redhat.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1745304956403805484?= X-GMAIL-MSGID: =?utf-8?q?1745304956403805484?= |
Series |
[committed] libstdc++: Guard use of new built-in with __has_builtin
|
|
Commit Message
Jonathan Wakely
Sept. 29, 2022, 11:54 a.m. UTC
This fixes libstdc++ for Clang and other non-GCC compilers. Tested powerpc64le-linux. Pushed to trunk as r13-2954-gdf7f2736509cfe. -- >8 -- I forgot that non-GCC compilers don't have this built-in yet. For Clang we could do something like the check below (as described in P2255), but for now I'm just fixing the regression. #if __has_builtin((__reference_binds_to_temporary) bool _Dangle = __reference_binds_to_temporary(_Tp, _Res_t) && __and_<is_reference<_Tp>, __not_<is_reference<_Res_t>>, is_convertible<__remove_cvref_t<_Res_t>*, __remove_cvref_t<_Tp>*>>::value #endif libstdc++-v3/ChangeLog: * include/std/type_traits (__is_invocable_impl): Check __has_builtin(__reference_converts_from_temporary) before using built-in. --- libstdc++-v3/include/std/type_traits | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 22c1af26397..a015fd95a71 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -2901,7 +2901,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Tp, bool _Nothrow = noexcept(_S_conv<_Tp>(_S_get())), typename = decltype(_S_conv<_Tp>(_S_get())), - bool _Dangle = __reference_converts_from_temporary(_Tp, _Res_t)> +#if __has_builtin(__reference_converts_from_temporary) + bool _Dangle = __reference_converts_from_temporary(_Tp, _Res_t) +#else + bool _Dangle = false +#endif + > static __bool_constant<_Nothrow && !_Dangle> _S_test(int);