public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r13-8332] libstdc++: Guard tr2::bases and tr2::direct_bases with __has_builtin
Date: Fri, 16 Feb 2024 15:12:20 +0000 (GMT)	[thread overview]
Message-ID: <20240216151220.883F838582B1@sourceware.org> (raw)

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
 }

                 reply	other threads:[~2024-02-16 15:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240216151220.883F838582B1@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /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).