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 A99BF3858291 for ; Tue, 19 Jul 2022 10:09:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A99BF3858291 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-307-mLByMWngMNehnIfJXsCeVw-1; Tue, 19 Jul 2022 06:09:13 -0400 X-MC-Unique: mLByMWngMNehnIfJXsCeVw-1 Received: by mail-qk1-f198.google.com with SMTP id o13-20020a05620a2a0d00b006b46c5414b0so11580754qkp.23 for ; Tue, 19 Jul 2022 03:09:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WF6lR08duc0M/HGovFcB5RBef5jQKtBq7PuihjTMONc=; b=mymV1I2o+iUtd5ohw7alIPC9YiDbuMKxDCE1qQW47zb5+iZr28aE8uELi5Yt+ySY8B yHqCCnbV5vk+OPc1oDWseQwSaQOUMNpAwAsWLWFr7+w5qx4HaKAyUwnQi3RCBOW4Nlsb 5R53d4evcQqhi39/T+bfjKH0bSIZ2gmRhLIYaduYsfJbzdWSw1Vs5haP3eD7xZNvZGdj eoyulJ52Mx4wKGjC4M2DoD+ipXZ2gfMTqGFkifG32u+eIRO5WcLsxdPlASijId++VDa3 3ec0rv6CrRJyyjpDRgEWn7an5WGPvM6dbN6MyDGy6ff3l3fcVqr6r+c+o+ml6mQMNqRf 2Pug== X-Gm-Message-State: AJIora88U3hGfb7l7mn54z36hGC19fQZashmnrdU+BPPpu1b3F6IScGW smfw3WcUA9AljVDA3cNPuM6eTUmIM6Z6Lzy73c2wYBqqrnH5zBXDEqpxqY7tiNAtW/Z/CnZlFXu rqu2FB4GLMqoCAdxQGIEk15nGF6hWC+cb4w== X-Received: by 2002:ac8:5cd3:0:b0:31d:3adc:bd00 with SMTP id s19-20020ac85cd3000000b0031d3adcbd00mr24633883qta.594.1658225351269; Tue, 19 Jul 2022 03:09:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vVq1+V95r61QWnAPTIJgLD6QeYXgKoLwLYQQeww2C9ud9bSlNPrLIGO6KvQXqMM1JsrURCS7mFi3DgL7tsZpw= X-Received: by 2002:ac8:5cd3:0:b0:31d:3adc:bd00 with SMTP id s19-20020ac85cd3000000b0031d3adcbd00mr24633806qta.594.1658225349595; Tue, 19 Jul 2022 03:09:09 -0700 (PDT) MIME-Version: 1.0 References: <20220708174133.2462418-1-polacek@redhat.com> <7955e63f-c20e-482c-cea3-db0942ed0149@redhat.com> <16983f2a-f56a-1462-c2db-3e4bc6fa6ad7@redhat.com> <93e09683-22c9-9e13-9ae1-13c4b447f38f@redhat.com> In-Reply-To: From: Jonathan Wakely Date: Tue, 19 Jul 2022 11:08:58 +0100 Message-ID: Subject: Re: [PATCH] c++: Add __reference_con{struc, ver}ts_from_temporary [PR104477] To: Stephan Bergmann Cc: Marek Polacek , "libstdc++" , GCC Patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" 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, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2022 10:09:15 -0000 On Sun, 17 Jul 2022 at 22:13, Stephan Bergmann via Libstdc++ wrote: > > On 7/15/22 22:25, Marek Polacek via Gcc-patches wrote: > > Yeah, I guess so. But I've already pushed the patch. > > This commit obviously breaks using libstdc++ with Clang (in -std=c++2b > mode), which doesn't implement those new builtins. Something like the > below would fix that, Thanks, Stephan, I'll fix this. > > > diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits > > index b1a1deecf66..a6e028b42ec 100644 > > --- a/libstdc++-v3/include/std/type_traits > > +++ b/libstdc++-v3/include/std/type_traits > > @@ -3505,6 +3505,7 @@ 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 +3545,7 @@ template > > template > > inline constexpr bool reference_converts_from_temporary_v > > = reference_converts_from_temporary<_Tp, _Up>::value; > > +#endif > > #endif // C++23 > > > > #if _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED > > diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version > > index 5edca2f3007..7c4b7f7cc6d 100644 > > --- a/libstdc++-v3/include/std/version > > +++ b/libstdc++-v3/include/std/version > > @@ -304,7 +304,9 @@ > > #define __cpp_lib_byteswap 202110L > > #define __cpp_lib_constexpr_typeinfo 202106L > > #define __cpp_lib_is_scoped_enum 202011L > > +#if __has_builtin(__reference_constructs_from_temporary) && __has_builtin(__reference_converts_from_temporary) > > #define __cpp_lib_reference_from_temporary 202202L > > +#endif > > > > #if _GLIBCXX_HOSTED > > #define __cpp_lib_adaptor_iterator_pair_constructor 202106L >