public inbox for libstdc++-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-8194] libstdc++: Do not use __is_convertible unconditionally [PR113241]
Date: Sat,  6 Jan 2024 13:40:06 +0000 (GMT)	[thread overview]
Message-ID: <20240106134006.7BB673858D20@sourceware.org> (raw)

https://gcc.gnu.org/g:4c66513656775d551db36b53c253cf236f0eeba8

commit r13-8194-g4c66513656775d551db36b53c253cf236f0eeba8
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Jan 5 12:03:22 2024 +0000

    libstdc++: Do not use __is_convertible unconditionally [PR113241]
    
    The new __is_convertible built-in should only be used after checking
    that it's supported.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/113241
            * include/std/type_traits (is_convertible_v): Guard use of
            built-in with preprocessor check.
    
    (cherry picked from commit 57fa5b60bbbf8038b8a699d2bcebd2a9b2e29aa4)

Diff:
---
 libstdc++-v3/include/std/type_traits | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 2bd607a8b8f..2b05e371953 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -3359,8 +3359,13 @@ template <typename _Tp>
 #endif
 template <typename _Base, typename _Derived>
   inline constexpr bool is_base_of_v = __is_base_of(_Base, _Derived);
+#if __has_builtin(__is_convertible)
 template <typename _From, typename _To>
   inline constexpr bool is_convertible_v = __is_convertible(_From, _To);
+#else
+template <typename _From, typename _To>
+  inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value;
+#endif
 template<typename _Fn, typename... _Args>
   inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value;
 template<typename _Fn, typename... _Args>

                 reply	other threads:[~2024-01-06 13:40 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=20240106134006.7BB673858D20@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).