@@ -34,30 +34,27 @@ namespace __math {
34
34
# define _LIBCPP_SIGNBIT_CONSTEXPR
35
35
#endif
36
36
37
- _LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
38
- #ifdef _LIBCPP_PREFERRED_OVERLOAD
39
- _LIBCPP_PREFERRED_OVERLOAD
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
40
44
#endif
41
- bool
42
- signbit (float __x) _NOEXCEPT {
45
+
46
+ _LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI LIBCPP_SIGNBIT_OVERLOAD bool
47
+ signbit (float __x) _NOEXCEPT {
43
48
return __builtin_signbit (__x);
44
49
}
45
50
46
- _LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
47
- #ifdef _LIBCPP_PREFERRED_OVERLOAD
48
- _LIBCPP_PREFERRED_OVERLOAD
49
- #endif
50
- bool
51
- signbit (double __x) _NOEXCEPT {
51
+ _LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI LIBCPP_SIGNBIT_OVERLOAD bool
52
+ signbit (double __x) _NOEXCEPT {
52
53
return __builtin_signbit (__x);
53
54
}
54
55
55
- _LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
56
- #ifdef _LIBCPP_PREFERRED_OVERLOAD
57
- _LIBCPP_PREFERRED_OVERLOAD
58
- #endif
59
- bool
60
- signbit (long double __x) _NOEXCEPT {
56
+ _LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI LIBCPP_SIGNBIT_OVERLOAD bool
57
+ signbit (long double __x) _NOEXCEPT {
61
58
return __builtin_signbit (__x);
62
59
}
63
60
0 commit comments