diff --git a/sycl/include/CL/sycl/builtins.hpp b/sycl/include/CL/sycl/builtins.hpp index d8f577e188b7e..400fd080cef1f 100644 --- a/sycl/include/CL/sycl/builtins.hpp +++ b/sycl/include/CL/sycl/builtins.hpp @@ -530,7 +530,7 @@ detail::enable_if_t::value, T> abs(T x) __NOEXC { // genfloat max (genfloat x, genfloat y) template -detail::enable_if_t::value, T> max(T x, T y) __NOEXC { +detail::enable_if_t::value, T>(max)(T x, T y) __NOEXC { return __sycl_std::__invoke_fmax_common(x, y); } @@ -538,14 +538,14 @@ detail::enable_if_t::value, T> max(T x, T y) __NOEXC { // genfloatd max (genfloatd x, double y) // genfloath max (genfloath x, half y) template -detail::enable_if_t::value, T> -max(T x, typename T::element_type y) __NOEXC { +detail::enable_if_t::value, T>(max)( + T x, typename T::element_type y) __NOEXC { return __sycl_std::__invoke_fmax_common(x, T(y)); } // genfloat min (genfloat x, genfloat y) template -detail::enable_if_t::value, T> min(T x, T y) __NOEXC { +detail::enable_if_t::value, T>(min)(T x, T y) __NOEXC { return __sycl_std::__invoke_fmin_common(x, y); } @@ -553,8 +553,8 @@ detail::enable_if_t::value, T> min(T x, T y) __NOEXC { // genfloatd min (genfloatd x, double y) // genfloath min (genfloath x, half y) template -detail::enable_if_t::value, T> -min(T x, typename T::element_type y) __NOEXC { +detail::enable_if_t::value, T>(min)( + T x, typename T::element_type y) __NOEXC { return __sycl_std::__invoke_fmin_common(x, T(y)); } @@ -766,53 +766,57 @@ detail::enable_if_t::value, T> mad_sat(T a, T b, // igeninteger max (igeninteger x, igeninteger y) template -detail::enable_if_t::value, T> max(T x, T y) __NOEXC { +detail::enable_if_t::value, T>(max)(T x, + T y) __NOEXC { return __sycl_std::__invoke_s_max(x, y); } // ugeninteger max (ugeninteger x, ugeninteger y) template -detail::enable_if_t::value, T> max(T x, T y) __NOEXC { +detail::enable_if_t::value, T>(max)(T x, + T y) __NOEXC { return __sycl_std::__invoke_u_max(x, y); } // igeninteger max (vigeninteger x, sigeninteger y) template -detail::enable_if_t::value, T> -max(T x, typename T::element_type y) __NOEXC { +detail::enable_if_t::value, T>(max)( + T x, typename T::element_type y) __NOEXC { return __sycl_std::__invoke_s_max(x, T(y)); } // vugeninteger max (vugeninteger x, sugeninteger y) template -detail::enable_if_t::value, T> -max(T x, typename T::element_type y) __NOEXC { +detail::enable_if_t::value, T>(max)( + T x, typename T::element_type y) __NOEXC { return __sycl_std::__invoke_u_max(x, T(y)); } // igeninteger min (igeninteger x, igeninteger y) template -detail::enable_if_t::value, T> min(T x, T y) __NOEXC { +detail::enable_if_t::value, T>(min)(T x, + T y) __NOEXC { return __sycl_std::__invoke_s_min(x, y); } // ugeninteger min (ugeninteger x, ugeninteger y) template -detail::enable_if_t::value, T> min(T x, T y) __NOEXC { +detail::enable_if_t::value, T>(min)(T x, + T y) __NOEXC { return __sycl_std::__invoke_u_min(x, y); } // vigeninteger min (vigeninteger x, sigeninteger y) template -detail::enable_if_t::value, T> -min(T x, typename T::element_type y) __NOEXC { +detail::enable_if_t::value, T>(min)( + T x, typename T::element_type y) __NOEXC { return __sycl_std::__invoke_s_min(x, T(y)); } // vugeninteger min (vugeninteger x, sugeninteger y) template -detail::enable_if_t::value, T> -min(T x, typename T::element_type y) __NOEXC { +detail::enable_if_t::value, T>(min)( + T x, typename T::element_type y) __NOEXC { return __sycl_std::__invoke_u_min(x, T(y)); } diff --git a/sycl/include/CL/sycl/detail/generic_type_traits.hpp b/sycl/include/CL/sycl/detail/generic_type_traits.hpp index f5e37295c8321..78331225d20d5 100644 --- a/sycl/include/CL/sycl/detail/generic_type_traits.hpp +++ b/sycl/include/CL/sycl/detail/generic_type_traits.hpp @@ -582,11 +582,11 @@ struct RelConverter< }; template static constexpr T max_v() { - return std::numeric_limits::max(); + return (std::numeric_limits::max)(); } template static constexpr T min_v() { - return std::numeric_limits::min(); + return (std::numeric_limits::min)(); } template static constexpr T quiet_NaN() { diff --git a/sycl/include/CL/sycl/half_type.hpp b/sycl/include/CL/sycl/half_type.hpp index 647a0abff7fff..7a65197c3478b 100644 --- a/sycl/include/CL/sycl/half_type.hpp +++ b/sycl/include/CL/sycl/half_type.hpp @@ -306,11 +306,11 @@ template <> struct numeric_limits { static constexpr const float_round_style round_style = round_to_nearest; - static __SYCL_CONSTEXPR_ON_DEVICE const half min() noexcept { + static __SYCL_CONSTEXPR_ON_DEVICE const half(min)() noexcept { return SYCL_HLF_MIN; } - static __SYCL_CONSTEXPR_ON_DEVICE const half max() noexcept { + static __SYCL_CONSTEXPR_ON_DEVICE const half(max)() noexcept { return SYCL_HLF_MAX; } diff --git a/sycl/include/CL/sycl/intel/group_algorithm.hpp b/sycl/include/CL/sycl/intel/group_algorithm.hpp index f4b59a2b4068e..8da599d73573d 100644 --- a/sycl/include/CL/sycl/intel/group_algorithm.hpp +++ b/sycl/include/CL/sycl/intel/group_algorithm.hpp @@ -98,7 +98,7 @@ template struct identity> { }; template struct identity> { - static constexpr T value = std::numeric_limits::max(); + static constexpr T value = (std::numeric_limits::max)(); }; template struct identity> { diff --git a/sycl/test/basic_tests/min_max_test.cpp b/sycl/test/basic_tests/min_max_test.cpp new file mode 100644 index 0000000000000..5934d2975846e --- /dev/null +++ b/sycl/test/basic_tests/min_max_test.cpp @@ -0,0 +1,12 @@ +// REQUIRES: windows +// RUN: %clangxx -fsycl -fsycl-device-only -fsyntax-only -Xclang -verify %s -I %sycl_include +// expected-no-diagnostics + +#include "windows.h" + +#include "CL/sycl.hpp" + +int main() { + int tmp = min(1, 4); + return 0; +}