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 A6AD73858439 for ; Tue, 19 Jul 2022 11:11:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A6AD73858439 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-474-xHhaN6JrMsmaAun33mx5gg-1; Tue, 19 Jul 2022 07:11:10 -0400 X-MC-Unique: xHhaN6JrMsmaAun33mx5gg-1 Received: by mail-ed1-f71.google.com with SMTP id z14-20020a056402274e00b0043ae5c003c1so9725874edd.9 for ; Tue, 19 Jul 2022 04:11:10 -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=vYKoBNty889Uiz2Wa1rL8BRa9prniC3GOcJyawxwEgY=; b=lyPmS3c7gRyMXenuNJJjLiUO84iWEzCPN+ZtDgAFpibssSoT6hzn4noL3yzMMg6071 3rNShBlEIiFuZZMHSvotvxFLkIhVVEkjigiBJw7NiCRmzZ/2gsOr0mu22Ss97vIvuY0o 5OEq5JqTjXt+g7+XId9JGW3gxjjn6/nahr66/kxH6Ingtxo/+g60IWcYKGasapqQO+RD +VZMCMuNODgcqTS97EoosfFszCBr0/jGe3YheXJn2iyOIDfFbb51qe3Q56uTbNuPkuky WNS1fpH3HzgxIkC0lrLXlHIVMvglkiHidTy1iJ8a3IRgiVk3Gou2xZuSIEhiORXvGpHA LDbA== X-Gm-Message-State: AJIora/wwv0jRJkFrbQLUM5nfKXWFIg6sBhVyu221yXd8hIo7lISiwKn FJJl9zMDdASpbuIOG6M0LQTakd5Lhe0eyLM/8i81W/uj2p2ALBpzhmEFUinSkP/JVFRW6JeWzkd +F43PigeQkuicoaDv0Cpt9BOQkytYNkc= X-Received: by 2002:a17:907:3d94:b0:72b:54bc:aa38 with SMTP id he20-20020a1709073d9400b0072b54bcaa38mr30190593ejc.679.1658229069243; Tue, 19 Jul 2022 04:11:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s6iLy9jctH41RI7e8JrvTePvO9sJTBHp3ukUUoR1llRCHSHVaBfsQ5Ggsvju8UB29eyus9YUWjFkiL4mFVDRQ= X-Received: by 2002:a17:907:3d94:b0:72b:54bc:aa38 with SMTP id he20-20020a1709073d9400b0072b54bcaa38mr30190582ejc.679.1658229069047; Tue, 19 Jul 2022 04:11: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 12:10:57 +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=-12.9 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 11:11:19 -0000 On Tue, 19 Jul 2022 at 11:08, Jonathan Wakely wrote: > > 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. This patch doesn't work, because __has_builtin doesn't detect the new built-ins. I have a patch that solves that, so we can make the change to the library headers. > > > > > > 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 > >