public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-8332] libstdc++: Guard tr2::bases and tr2::direct_bases with __has_builtin
@ 2024-02-16 15:12 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2024-02-16 15:12 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:e1a1e817fcaf998d8b2f6ba0e041d4a1d42c3352

commit r13-8332-ge1a1e817fcaf998d8b2f6ba0e041d4a1d42c3352
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Feb 8 15:38:35 2024 +0000

    libstdc++: Guard tr2::bases and tr2::direct_bases with __has_builtin
    
    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.
    
    (cherry picked from commit 5fb204aaf34b68c427f5b2bfb933fed72fe3eafb)

Diff:
---
 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 8723ab521d71..ae7f406ff2c3 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
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-16 15:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-16 15:12 [gcc r13-8332] libstdc++: Guard tr2::bases and tr2::direct_bases with __has_builtin 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).