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 643C73851145 for ; Tue, 19 Jul 2022 14:05:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 643C73851145 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-511-9Mb9sZ29PAGhY5AiiV6uFQ-1; Tue, 19 Jul 2022 10:05:04 -0400 X-MC-Unique: 9Mb9sZ29PAGhY5AiiV6uFQ-1 Received: by mail-qk1-f198.google.com with SMTP id v13-20020a05620a0f0d00b006b5f0ec742eso3775556qkl.2 for ; Tue, 19 Jul 2022 07:05:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=C1WdFRz8KXTwFHzf/cVkFhH1qk0MzFQqp3Y8h3ut4gw=; b=HlbZ+46Ecg95QLIxKpMYb7Ye0jFSmSE1Xa0BYjx9LxYdzSA6P1fIisB7SLOj2gMIqw 73HMAt+ryS9b0uNRwXC/dm3/BcJiX68ekAT4JrPKeiGzE7gL+/DSeq95M2QXvcu5wCBr JFF7Q4HARO/tOlJqEehx6Mrb8owlZJW0IQ9Emxc9lOqw6fcNqf87cPLaAppxv32zISxV sggTf0R0A9Qm7c1/2Nv+O+nW9t9A6G4yODNEQ6RGRRoupYqXiPFpCLoLTiH2Vp6osE+l gclChWdk5D0EhgNUHojMiyE+br8LN65hm/fXdIXy7Ies5IX+0bdMGBpiU+cw0Ax1V4N0 T7QQ== X-Gm-Message-State: AJIora+3ewNocbely6pPq7FMzyCWI+2SbNWJAy4ptOADH2x+Wl338s5g 4Wwi3wFhOp67kEF3PQFk+/s0XqgBgj6+ntto8q6AE/od+5FTjKoWDYGMEeyJ3XlSIFRMzzNKuth P7+ShzGSrQajohuU= X-Received: by 2002:ac8:9:0:b0:305:3451:f384 with SMTP id a9-20020ac80009000000b003053451f384mr25485294qtg.409.1658239504134; Tue, 19 Jul 2022 07:05:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uP9eZx3T9hsPfjgD7lpiGuh/jtTqEXwEBDIq58fdK8Rox7+jAWXrQn8ZvNp1QyZfom57MnPw== X-Received: by 2002:ac8:9:0:b0:305:3451:f384 with SMTP id a9-20020ac80009000000b003053451f384mr25485255qtg.409.1658239503809; Tue, 19 Jul 2022 07:05:03 -0700 (PDT) Received: from [192.168.1.100] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id i16-20020ac871d0000000b0031eb9908eaesm10322021qtp.96.2022.07.19.07.05.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Jul 2022 07:05:03 -0700 (PDT) Message-ID: <84cfad37-0c5b-4444-b2ae-65c7aea12e8c@redhat.com> Date: Tue, 19 Jul 2022 10:05:02 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] c++: Enable __has_builtin for new reference binding built-ins To: Jonathan Wakely , libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Marek Polacek References: <20220719131102.2469016-1-jwakely@redhat.com> From: Jason Merrill In-Reply-To: <20220719131102.2469016-1-jwakely@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, 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: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2022 14:05:09 -0000 On 7/19/22 09:11, Jonathan Wakely wrote: > Tested x86_64-linux, OK for trunk? OK. > -- >8 -- > > The new built-ins need to be detectable using __has_builtin, and the > library should use that to check for them. > > This fixes an error with Clang when C++23 is enabled. > > gcc/cp/ChangeLog: > > * cp-objcp-common.cc (names_builtin_p): Return true for > RID_REF_CONSTRUCTS_FROM_TEMPORARY and > RID_REF_CONVERTS_FROM_TEMPORARY. > > libstdc++-v3/ChangeLog: > > * include/std/type_traits (__cpp_lib_reference_from_temporary) > (reference_constructs_from_temporary) > (reference_converts_from_temporary): Only define when the > built-ins are available. > --- > gcc/cp/cp-objcp-common.cc | 2 ++ > libstdc++-v3/include/std/type_traits | 4 ++++ > 2 files changed, 6 insertions(+) > > diff --git a/gcc/cp/cp-objcp-common.cc b/gcc/cp/cp-objcp-common.cc > index 0b70d5567e4..4079a4b4aec 100644 > --- a/gcc/cp/cp-objcp-common.cc > +++ b/gcc/cp/cp-objcp-common.cc > @@ -461,6 +461,8 @@ names_builtin_p (const char *name) > case RID_IS_ASSIGNABLE: > case RID_IS_CONSTRUCTIBLE: > case RID_UNDERLYING_TYPE: > + case RID_REF_CONSTRUCTS_FROM_TEMPORARY: > + case RID_REF_CONVERTS_FROM_TEMPORARY: > return true; > default: > break; > diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits > index b1a1deecf66..14b029cec64 100644 > --- a/libstdc++-v3/include/std/type_traits > +++ b/libstdc++-v3/include/std/type_traits > @@ -3505,6 +3505,9 @@ template > template > inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value; > > +#if __has_builtin(__reference_constructs_from_temporary) \ > + && __has_builtin(__reference_converts_from_temporary) > + > #define __cpp_lib_reference_from_temporary 202202L > > /// True if _Tp is a reference type, a _Up value can be bound to _Tp in > @@ -3544,6 +3547,7 @@ template > template > inline constexpr bool reference_converts_from_temporary_v > = reference_converts_from_temporary<_Tp, _Up>::value; > +#endif // __has_builtin for reference_from_temporary > #endif // C++23 > > #if _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED