* [committed] libstdc++: Guard tr2::bases and tr2::direct_bases with __has_builtin
@ 2024-02-08 16:00 Jonathan Wakely
2024-02-08 17:05 ` Jonathan Wakely
0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Wakely @ 2024-02-08 16:00 UTC (permalink / raw)
To: libstdc++, gcc-patches
Tested x86_64-linux. Pusued to trunk. I'll backport it too.
-- >8 --
These non-standard extensions use GCC-specific built-ins. Use
__has_builtin to avoid errors when Clang compiles this header.
See https://github.com/llvm/llvm-project/issues/24289
libstdc++-v3/ChangeLog:
* include/tr2/type_traits (bases, direct_bases): Use
__has_builtin to check if required built-ins are supported.
---
libstdc++-v3/include/tr2/type_traits | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libstdc++-v3/include/tr2/type_traits b/libstdc++-v3/include/tr2/type_traits
index a7ebaf66947..603039de894 100644
--- a/libstdc++-v3/include/tr2/type_traits
+++ b/libstdc++-v3/include/tr2/type_traits
@@ -82,20 +82,23 @@ namespace tr2
/// Sequence abstraction metafunctions for manipulating a typelist.
-
+#if __has_builtin(__bases)
/// Enumerate all the base classes of a class. Form of a typelist.
template<typename _Tp>
struct bases
{
typedef __reflection_typelist<__bases(_Tp)...> type;
};
+#endif
+#if __has_builtin(__direct_bases)
/// Enumerate all the direct base classes of a class. Form of a typelist.
template<typename _Tp>
struct direct_bases
{
typedef __reflection_typelist<__direct_bases(_Tp)...> type;
};
+#endif
/// @} group metaprogramming
}
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [committed] libstdc++: Guard tr2::bases and tr2::direct_bases with __has_builtin
2024-02-08 16:00 [committed] libstdc++: Guard tr2::bases and tr2::direct_bases with __has_builtin Jonathan Wakely
@ 2024-02-08 17:05 ` Jonathan Wakely
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2024-02-08 17:05 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 193 bytes --]
On Thu, 8 Feb 2024 at 16:02, Jonathan Wakely wrote:
> Tested x86_64-linux. Pusued to trunk. I'll backport it too.
>
Only to gcc-13 though, because __has_builtin(__bases) is false for gcc-12.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-08 17:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-08 16:00 [committed] libstdc++: Guard tr2::bases and tr2::direct_bases with __has_builtin Jonathan Wakely
2024-02-08 17:05 ` Jonathan Wakely
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).