13
13
#include < __type_traits/integral_constant.h>
14
14
#include < __type_traits/is_arithmetic.h>
15
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
20
-
21
16
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
22
17
# pragma GCC system_header
23
18
#endif
24
19
25
20
_LIBCPP_BEGIN_NAMESPACE_STD
26
21
27
- // TODO(LLVM-20): Remove this workaround
28
- #if !defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER != 1700
29
-
30
22
template <class ... _Args>
31
23
class __promote {
32
24
static_assert ((is_arithmetic<_Args>::value && ...));
@@ -39,90 +31,17 @@ class __promote {
39
31
static double __test (unsigned long );
40
32
static double __test (long long );
41
33
static double __test (unsigned long long );
42
- # if _LIBCPP_HAS_INT128
34
+ #if _LIBCPP_HAS_INT128
43
35
static double __test (__int128_t );
44
36
static double __test (__uint128_t );
45
- # endif
37
+ #endif
46
38
static double __test (double );
47
39
static long double __test (long double );
48
40
49
41
public:
50
42
using type = decltype ((__test(_Args()) + ...));
51
43
};
52
44
53
- #else
54
-
55
- template <class _Tp >
56
- struct __numeric_type {
57
- static void __test (...);
58
- static float __test (float );
59
- static double __test (char );
60
- static double __test (int );
61
- static double __test (unsigned );
62
- static double __test (long );
63
- static double __test (unsigned long );
64
- static double __test (long long );
65
- static double __test (unsigned long long );
66
- # if _LIBCPP_HAS_INT128
67
- static double __test (__int128_t );
68
- static double __test (__uint128_t );
69
- # endif
70
- static double __test (double );
71
- static long double __test (long double );
72
-
73
- typedef decltype (__test(std::declval<_Tp>())) type;
74
- static const bool value = _IsNotSame<type, void >::value;
75
- };
76
-
77
- template <>
78
- struct __numeric_type <void > {
79
- static const bool value = true ;
80
- };
81
-
82
- template <class _A1 ,
83
- class _A2 = void ,
84
- class _A3 = void ,
85
- bool = __numeric_type<_A1>::value && __numeric_type<_A2>::value && __numeric_type<_A3>::value>
86
- class __promote_imp {
87
- public:
88
- static const bool value = false ;
89
- };
90
-
91
- template <class _A1 , class _A2 , class _A3 >
92
- class __promote_imp <_A1, _A2, _A3, true > {
93
- private:
94
- typedef typename __promote_imp<_A1>::type __type1;
95
- typedef typename __promote_imp<_A2>::type __type2;
96
- typedef typename __promote_imp<_A3>::type __type3;
97
-
98
- public:
99
- typedef decltype (__type1() + __type2() + __type3()) type;
100
- static const bool value = true ;
101
- };
102
-
103
- template <class _A1 , class _A2 >
104
- class __promote_imp <_A1, _A2, void , true > {
105
- private:
106
- typedef typename __promote_imp<_A1>::type __type1;
107
- typedef typename __promote_imp<_A2>::type __type2;
108
-
109
- public:
110
- typedef decltype (__type1() + __type2()) type;
111
- static const bool value = true ;
112
- };
113
-
114
- template <class _A1 >
115
- class __promote_imp <_A1, void , void , true > {
116
- public:
117
- typedef typename __numeric_type<_A1>::type type;
118
- static const bool value = true ;
119
- };
120
-
121
- template <class _A1 , class _A2 = void , class _A3 = void >
122
- class __promote : public __promote_imp <_A1, _A2, _A3> {};
123
-
124
- #endif // !defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER >= 1700
125
-
126
45
_LIBCPP_END_NAMESPACE_STD
127
46
128
47
#endif // _LIBCPP___TYPE_TRAITS_PROMOTE_H
0 commit comments