File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,18 @@ _LIBCPP_NODISCARD _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfin
55
55
return true ;
56
56
}
57
57
58
+ _LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite (float __x) _NOEXCEPT {
59
+ return __builtin_isfinite (__x);
60
+ }
61
+
62
+ _LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite (double __x) _NOEXCEPT {
63
+ return __builtin_isfinite (__x);
64
+ }
65
+
66
+ _LIBCPP_NODISCARD inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite (long double __x) _NOEXCEPT {
67
+ return __builtin_isfinite (__x);
68
+ }
69
+
58
70
// isinf
59
71
60
72
template <class _A1 , __enable_if_t <is_arithmetic<_A1>::value && numeric_limits<_A1>::has_infinity, int > = 0 >
Original file line number Diff line number Diff line change @@ -62,9 +62,21 @@ struct TestInt {
62
62
}
63
63
};
64
64
65
+ template <typename T>
66
+ struct ConvertibleTo {
67
+ operator T () const { return T (); }
68
+ };
69
+
65
70
int main (int , char **) {
66
71
types::for_each (types::floating_point_types (), TestFloat ());
67
72
types::for_each (types::integral_types (), TestInt ());
68
73
74
+ // Make sure we can call `std::isfinite` with convertible types
75
+ {
76
+ assert (std::isfinite (ConvertibleTo<float >()));
77
+ assert (std::isfinite (ConvertibleTo<double >()));
78
+ assert (std::isfinite (ConvertibleTo<long double >()));
79
+ }
80
+
69
81
return 0 ;
70
82
}
You can’t perform that action at this time.
0 commit comments