From: Stephan Bergmann <sbergman@redhat.com>
To: Marek Polacek <polacek@redhat.com>
Cc: libstdc++ <libstdc++@gcc.gnu.org>, GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] c++: Add __reference_con{struc,ver}ts_from_temporary [PR104477]
Date: Sun, 17 Jul 2022 23:12:43 +0200 [thread overview]
Message-ID: <bcdea58e-0891-8e0a-21e0-9ed6bdf906ba@redhat.com> (raw)
In-Reply-To: <YtHNO4AzynEy4GKM@redhat.com>
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,
> 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<typename _Ret, typename _Fn, typename... _Args>
> template<typename _Tp>
> 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<typename _Ret, typename _Fn, typename... _Args>
> template<typename _Tp, typename _Up>
> 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
next prev parent reply other threads:[~2022-07-17 21:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-08 17:41 [PATCH] c++: Add __reference_con{struc, ver}ts_from_temporary [PR104477] Marek Polacek
2022-07-11 10:19 ` Jonathan Wakely
2022-07-12 17:16 ` [PATCH v2] c++: Add __reference_con{struc,ver}ts_from_temporary [PR104477] Marek Polacek
2022-07-12 20:10 ` [PATCH] " Jason Merrill
2022-07-12 20:15 ` Jason Merrill
2022-07-14 17:43 ` Marek Polacek
2022-07-15 3:48 ` Jason Merrill
2022-07-15 15:32 ` Marek Polacek
2022-07-15 19:59 ` [PATCH] c++: Add __reference_con{struc, ver}ts_from_temporary [PR104477] Ville Voutilainen
2022-07-15 20:25 ` [PATCH] c++: Add __reference_con{struc,ver}ts_from_temporary [PR104477] Marek Polacek
2022-07-17 21:12 ` Stephan Bergmann [this message]
2022-07-19 10:08 ` [PATCH] c++: Add __reference_con{struc, ver}ts_from_temporary [PR104477] Jonathan Wakely
2022-07-19 11:10 ` Jonathan Wakely
2022-07-19 14:14 ` Jonathan Wakely
2022-07-14 17:41 ` [PATCH v3] c++: Add __reference_con{struc,ver}ts_from_temporary [PR104477] Marek Polacek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bcdea58e-0891-8e0a-21e0-9ed6bdf906ba@redhat.com \
--to=sbergman@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
--cc=polacek@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).