aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-01-05 12:03:22 +0000
committerJonathan Wakely <jwakely@redhat.com>2024-01-05 13:57:05 +0000
commit57fa5b60bbbf8038b8a699d2bcebd2a9b2e29aa4 (patch)
tree93bee231e7b7d2063e6fe2497c3364b053006e2a
parent29abd09a744970bf2b93d078bad9946899ef2b05 (diff)
downloadgcc-57fa5b60bbbf8038b8a699d2bcebd2a9b2e29aa4.zip
gcc-57fa5b60bbbf8038b8a699d2bcebd2a9b2e29aa4.tar.gz
gcc-57fa5b60bbbf8038b8a699d2bcebd2a9b2e29aa4.tar.bz2
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.
-rw-r--r--libstdc++-v3/include/std/type_traits5
1 files changed, 5 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index a71162b..3b1b419 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -3477,8 +3477,13 @@ template <typename _Tp>
#endif
template <typename _Base, typename _Derived>
inline constexpr bool is_base_of_v = __is_base_of(_Base, _Derived);
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__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>