brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · a8434e3 Raw
29 lines · c
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_STD10 11// Suppress deprecation notice for volatile-qualified return type resulting12// from volatile-qualified types _Tp.13_LIBCPP_SUPPRESS_DEPRECATED_PUSH14template <class _Tp> __attribute__((device)) _Tp &&__declval(int);15template <class _Tp> __attribute__((device)) _Tp __declval(long);16_LIBCPP_SUPPRESS_DEPRECATED_POP17 18template <class _Tp>19__attribute__((device)) _LIBCPP_HIDE_FROM_ABI decltype(std::__declval<_Tp>(0))20declval() _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_STD28#endif // __CUDA_WRAPPERS_UTILITY_DECLVAL_H__29