| 1 |
#ifndef __CUDA_WRAPPERS_UTILITY_DECLVAL_H__ |
| 2 |
#define __CUDA_WRAPPERS_UTILITY_DECLVAL_H__ |
| 3 |
|
| 4 |
#include_next <__utility/declval.h> |
| 5 |
|
| 6 |
// The stuff below is the exact copy of the <__utility/declval.h>, |
| 7 |
// but with __device__ attribute applied to the functions, so it works on a GPU. |
| 8 |
|
| 9 |
_LIBCPP_BEGIN_NAMESPACE_STD |
| 10 |
|
| 11 |
// Suppress deprecation notice for volatile-qualified return type resulting |
| 12 |
// from volatile-qualified types _Tp. |
| 13 |
_LIBCPP_SUPPRESS_DEPRECATED_PUSH |
| 14 |
template <class _Tp> __attribute__((device)) _Tp &&__declval(int); |
| 15 |
template <class _Tp> __attribute__((device)) _Tp __declval(long); |
| 16 |
_LIBCPP_SUPPRESS_DEPRECATED_POP |
| 17 |
|
| 18 |
template <class _Tp> |
| 19 |
__attribute__((device)) _LIBCPP_HIDE_FROM_ABI decltype(std::__declval<_Tp>(0)) |
| 20 |
declval() _NOEXCEPT { |
| 21 |
static_assert(!__is_same(_Tp, _Tp), |
| 22 |
"std::declval can only be used in an unevaluated context. " |
| 23 |
"It's likely that your current usage is trying to extract a " |
| 24 |
"value from the function."); |
| 25 |
} |
| 26 |
|
| 27 |
_LIBCPP_END_NAMESPACE_STD |
| 28 |
#endif // __CUDA_WRAPPERS_UTILITY_DECLVAL_H__ |