11
11
12
12
#include < __config>
13
13
#include < __type_traits/integral_constant.h>
14
- #include < __type_traits/is_same.h>
15
- #include < __utility/declval.h>
14
+ #include < __type_traits/is_arithmetic.h>
15
+
16
+ #if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER == 1700
17
+ # include < __type_traits/is_same.h>
18
+ # include < __utility/declval.h>
19
+ #endif
16
20
17
21
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
18
22
# pragma GCC system_header
19
23
#endif
20
24
21
25
_LIBCPP_BEGIN_NAMESPACE_STD
22
26
27
+ // TODO(LLVM-20): Remove this workaround
28
+ #if !defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER != 1700
29
+
30
+ template <class ... _Args>
31
+ class __promote {
32
+ static_assert ((is_arithmetic<_Args>::value && ...));
33
+
34
+ static float __test (float );
35
+ static double __test (char );
36
+ static double __test (int );
37
+ static double __test (unsigned );
38
+ static double __test (long );
39
+ static double __test (unsigned long );
40
+ static double __test (long long );
41
+ static double __test (unsigned long long );
42
+ # ifndef _LIBCPP_HAS_NO_INT128
43
+ static double __test (__int128_t );
44
+ static double __test (__uint128_t );
45
+ # endif
46
+ static double __test (double );
47
+ static long double __test (long double );
48
+
49
+ public:
50
+ using type = decltype((__test(_Args()) + ...));
51
+ };
52
+
53
+ #else
54
+
23
55
template <class _Tp >
24
56
struct __numeric_type {
25
57
static void __test (...);
@@ -31,10 +63,10 @@ struct __numeric_type {
31
63
static double __test (unsigned long );
32
64
static double __test (long long );
33
65
static double __test (unsigned long long );
34
- #ifndef _LIBCPP_HAS_NO_INT128
66
+ # ifndef _LIBCPP_HAS_NO_INT128
35
67
static double __test (__int128_t );
36
68
static double __test (__uint128_t );
37
- #endif
69
+ # endif
38
70
static double __test (double );
39
71
static long double __test (long double );
40
72
@@ -89,6 +121,8 @@ class __promote_imp<_A1, void, void, true> {
89
121
template <class _A1 , class _A2 = void , class _A3 = void >
90
122
class __promote : public __promote_imp <_A1, _A2, _A3> {};
91
123
124
+ #endif // !defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER >= 1700
125
+
92
126
_LIBCPP_END_NAMESPACE_STD
93
127
94
128
#endif // _LIBCPP___TYPE_TRAITS_PROMOTE_H
0 commit comments