* [committed] libstdc++: Do not use __is_convertible unconditionally [PR113241]
@ 2024-01-05 14:27 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2024-01-05 14:27 UTC (permalink / raw)
To: libstdc++, gcc-patches
Tested x86_64-linux. Pushed to trunk, backport to gcc-13 needed too.
-- >8 --
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.
---
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 a71162b33ec..3b1b419bbbb 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>
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-01-05 14:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-05 14:27 [committed] libstdc++: Do not use __is_convertible unconditionally [PR113241] 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).