Skip to content

Commit 8886fd1

Browse files
committed
[HIP] Fix return type in __clang_hip_cmath.h
Before, some functions like std::isgreater(double, doulbe) would return a double instead of a bool.
1 parent 61536f2 commit 8886fd1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

clang/lib/Headers/__clang_hip_cmath.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -464,12 +464,13 @@ class __promote : public __promote_imp<_A1, _A2, _A3> {};
464464
#if __cplusplus >= 201103L
465465
#define __HIP_OVERLOAD2(__retty, __fn) \
466466
template <typename __T1, typename __T2> \
467-
__DEVICE__ __CONSTEXPR__ typename __hip_enable_if< \
468-
__hip::is_arithmetic<__T1>::value && __hip::is_arithmetic<__T2>::value, \
469-
typename __hip::__promote<__T1, __T2>::type>::type \
470-
__fn(__T1 __x, __T2 __y) { \
471-
typedef typename __hip::__promote<__T1, __T2>::type __result_type; \
472-
return __fn((__result_type)__x, (__result_type)__y); \
467+
__DEVICE__ __CONSTEXPR__ \
468+
typename __hip_enable_if<__hip::is_arithmetic<__T1>::value && \
469+
__hip::is_arithmetic<__T2>::value, \
470+
__retty>::type \
471+
__fn(__T1 __x, __T2 __y) { \
472+
typedef typename __hip::__promote<__T1, __T2>::type __arg_type; \
473+
return __fn((__arg_type)__x, (__arg_type)__y); \
473474
}
474475
#else
475476
#define __HIP_OVERLOAD2(__retty, __fn) \

0 commit comments

Comments
 (0)