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.133.124]) by sourceware.org (Postfix) with ESMTPS id C99283858281 for ; Tue, 19 Jul 2022 13:30:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C99283858281 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-304-sM1v-KO3PT20UnpbInMnTw-1; Tue, 19 Jul 2022 09:30:36 -0400 X-MC-Unique: sM1v-KO3PT20UnpbInMnTw-1 Received: by mail-qk1-f200.google.com with SMTP id s9-20020a05620a254900b006b54dd4d6deso11704985qko.3 for ; Tue, 19 Jul 2022 06:30:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=W5u1riCyh9jAkUjvXz0AV99trnkA4usjYdkxCO/oyFE=; b=pTrKvf92N8NM+kvr+vo446EidY0iFBCZ9OrHEZX/ze9J7hboU5wM48pwKgGXEpQIuS KINRDaQtwEyoDq+wBld9dk2RhSPqf3KVpecTuigMNXILqP2Q9l83d0zhrNjRNbQdFOmH 0BwGPWxPSr4wqiU0Kpbc5kzu/8Ujnw8XWZo/wFb4+xFEbNAoqL8ID8Rzi7RrfMgQhzqt A+7elFRvKOsi35ylhCWhqWGPMcHnpEzSFYUY5p2ONcxcSi1ZygNrk6Y3n0mNLzsXUVmb uLoX468WSgZfQZVTuboO430ABolfOO4od4OUChkW6kmfgZp1fL66ab+lRewDsfIkbyUl di8g== X-Gm-Message-State: AJIora9XBa8vS8bDHfS0VjK7fl+xjr1YMu9YfJoAM2eEGRoZ8odRa1GK FHsOWTc1JgFo47dvQnFoy3Dl+F5COrb4B870vUotEWq+y1hJLXOUVhI6SxoVv1mw8iGocUQSEfv FVB8SXPjtpbGdrxY= X-Received: by 2002:a05:622a:315:b0:31e:e250:c5f with SMTP id q21-20020a05622a031500b0031ee2500c5fmr12658825qtw.206.1658237436278; Tue, 19 Jul 2022 06:30:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uiwWj4iHbswD96jjUKk14rlw7QrntnE5Q7KK5NEHMZCFsOJEdwttH24Dq51npDX+CcZFh9dw== X-Received: by 2002:a05:622a:315:b0:31e:e250:c5f with SMTP id q21-20020a05622a031500b0031ee2500c5fmr12658679qtw.206.1658237434561; Tue, 19 Jul 2022 06:30:34 -0700 (PDT) Received: from redhat.com ([2601:184:4780:4310::b5c3]) by smtp.gmail.com with ESMTPSA id h13-20020a05620a284d00b006aee5df383csm13625852qkp.134.2022.07.19.06.30.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 06:30:34 -0700 (PDT) Date: Tue, 19 Jul 2022 09:30:32 -0400 From: Marek Polacek To: Jonathan Wakely Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org, Jason Merrill Subject: Re: [PATCH] c++: Enable __has_builtin for new reference binding built-ins Message-ID: References: <20220719131102.2469016-1-jwakely@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220719131102.2469016-1-jwakely@redhat.com> User-Agent: Mutt/2.2.6 (2022-06-05) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-13.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_NONE, 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: 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 13:30:41 -0000 On Tue, Jul 19, 2022 at 02:11:02PM +0100, Jonathan Wakely wrote: > Tested x86_64-linux, OK for trunk? > > -- >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. LGTM but can't approve. Thanks and sorry for missing this! > 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 > -- > 2.34.3 > Marek