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 954DD3858285 for ; Tue, 19 Jul 2022 10:09:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 954DD3858285 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-413-iMN1ZJdkO-i7w7BD-pcOiw-1; Tue, 19 Jul 2022 06:09:13 -0400 X-MC-Unique: iMN1ZJdkO-i7w7BD-pcOiw-1 Received: by mail-qk1-f200.google.com with SMTP id s9-20020a05620a254900b006b54dd4d6deso11361696qko.3 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=thzcYuc0vRusoQppQ5ZUrbMMQKKYFzZ9qYDZv2R77PMSSFWTyLfNvEtbK/WfMY7aRe xEw4X4jxFJrrC9e4/LqDUpC127VVCppLQIJ3NVPtrI5VGQrZb9piZs7Z/rovfWF3o3Ox N5AiIPe9EN/wjUsbOen98/phXATAvdVwzazzAT+3h9d3A4PXvPNyomlJ3VIWD9N3FIcR 9AgEUUZkNwFx4PEcPfmpg1z1AzgAAwmGGtwka0eGbx7Iey/cfoepBo/MVsYY4hGmdgld 0/oSjD05l6uL5IuMHQO9BeMgfz+ati224Apaw7Lirls5eWSH3lM3IjncssuFNaB/7ITz 5USw== X-Gm-Message-State: AJIora8u3jnJHjz6/lfowpCEgossmfMANrbY9NCvX3ZdPJDmCNqHfcrm m9rHBEXIZ+TF2xskwb/HS3pMlIYZEnt+fbpK6wwXLzlha3ZWK5Ls9T8RI4bHPFyRzM2ocVRQRbg RkXhIMepIvKCFYpaPcqF135s+MaxV3/E= X-Received: by 2002:ac8:5cd3:0:b0:31d:3adc:bd00 with SMTP id s19-20020ac85cd3000000b0031d3adcbd00mr24633884qta.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.5 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: 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 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 >