Skip to content

Commit

Permalink
libstdc++: Do not use __is_convertible unconditionally [PR113241]
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jwakely committed Jan 5, 2024
1 parent 29abd09 commit 57fa5b6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libstdc++-v3/include/std/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 57fa5b6

Please sign in to comment.