jlebar created this revision. jlebar added reviewers: rsmith, tra. Herald added a subscriber: sanjoy.
Tests in a separate change to the test-suite. https://reviews.llvm.org/D48151 Files: clang/lib/Headers/cuda_wrappers/algorithm Index: clang/lib/Headers/cuda_wrappers/algorithm =================================================================== --- clang/lib/Headers/cuda_wrappers/algorithm +++ clang/lib/Headers/cuda_wrappers/algorithm @@ -67,34 +67,43 @@ #endif #endif +#pragma push_macro("_CPP14_CONSTEXPR") +#if __cplusplus >= 201402L +#define _CPP14_CONSTEXPR constexpr +#else +#define _CPP14_CONSTEXPR +#endif + template <class __T, class __Cmp> __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & max(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__a, __b) ? __b : __a; } template <class __T> __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & max(const __T &__a, const __T &__b) { return __a < __b ? __b : __a; } template <class __T, class __Cmp> __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & min(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__b, __a) ? __b : __a; } template <class __T> __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & min(const __T &__a, const __T &__b) { return __a < __b ? __a : __b; } +#pragma pop_macro("_CPP14_CONSTEXPR") + #ifdef _LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD #else
Index: clang/lib/Headers/cuda_wrappers/algorithm =================================================================== --- clang/lib/Headers/cuda_wrappers/algorithm +++ clang/lib/Headers/cuda_wrappers/algorithm @@ -67,34 +67,43 @@ #endif #endif +#pragma push_macro("_CPP14_CONSTEXPR") +#if __cplusplus >= 201402L +#define _CPP14_CONSTEXPR constexpr +#else +#define _CPP14_CONSTEXPR +#endif + template <class __T, class __Cmp> __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & max(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__a, __b) ? __b : __a; } template <class __T> __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & max(const __T &__a, const __T &__b) { return __a < __b ? __b : __a; } template <class __T, class __Cmp> __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & min(const __T &__a, const __T &__b, __Cmp __cmp) { return __cmp(__b, __a) ? __b : __a; } template <class __T> __attribute__((enable_if(true, ""))) -inline __host__ __device__ const __T & +inline _CPP14_CONSTEXPR __host__ __device__ const __T & min(const __T &__a, const __T &__b) { return __a < __b ? __a : __b; } +#pragma pop_macro("_CPP14_CONSTEXPR") + #ifdef _LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD #else
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits