@@ -34,27 +34,21 @@ namespace __math {
34
34
# define _LIBCPP_SIGNBIT_CONSTEXPR
35
35
#endif
36
36
37
- // The universal C runtime (UCRT) in the WinSDK provides overloads for all floating point types
38
- // for std::signbit(). We need to work around it as the compilation would otherwise error out
39
- // due to duplicated definitions for clang-cl builds.
40
- #if defined(_LIBCPP_MSVCRT) && defined(_LIBCPP_PREFERRED_OVERLOAD)
41
- # define LIBCPP_SIGNBIT_OVERLOAD _LIBCPP_PREFERRED_OVERLOAD
42
- #else
43
- # define LIBCPP_SIGNBIT_OVERLOAD
44
- #endif
45
-
46
- _LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI LIBCPP_SIGNBIT_OVERLOAD bool
47
- signbit (float __x) _NOEXCEPT {
37
+ // The universal C runtime (UCRT) in the WinSDK provides floating point overloads
38
+ // for std::signbit(). By defining our overloads as templates, we can work around
39
+ // this issue as templates are less preferred than non-template functions.
40
+ template <class = void >
41
+ _LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit (float __x) _NOEXCEPT {
48
42
return __builtin_signbit (__x);
49
43
}
50
44
51
- _LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI LIBCPP_SIGNBIT_OVERLOAD bool
52
- signbit (double __x) _NOEXCEPT {
45
+ template < class = void >
46
+ _LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit (double __x) _NOEXCEPT {
53
47
return __builtin_signbit (__x);
54
48
}
55
49
56
- _LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI LIBCPP_SIGNBIT_OVERLOAD bool
57
- signbit (long double __x) _NOEXCEPT {
50
+ template < class = void >
51
+ _LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI bool signbit (long double __x) _NOEXCEPT {
58
52
return __builtin_signbit (__x);
59
53
}
60
54
0 commit comments