From 32f69c8bc422e887aa177dab3f6caab2d8a977af Mon Sep 17 00:00:00 2001 From: Michael LIAO Date: Fri, 3 May 2019 15:55:40 -0400 Subject: [PATCH] [test] Add device variant of `std::declval`. - Current clang disallows any invocation of wrong-side functions even under context with type-inspection only. Work around that by adding a variant of `std::decl` with `__device__` attribute. --- hipamd/tests/src/deviceLib/hipVectorTypesDevice.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hipamd/tests/src/deviceLib/hipVectorTypesDevice.cpp b/hipamd/tests/src/deviceLib/hipVectorTypesDevice.cpp index 74bf932b3a..a1db8de361 100644 --- a/hipamd/tests/src/deviceLib/hipVectorTypesDevice.cpp +++ b/hipamd/tests/src/deviceLib/hipVectorTypesDevice.cpp @@ -37,9 +37,12 @@ THE SOFTWARE. using namespace std; +template __device__ +typename std::add_rvalue_reference::type _declval() noexcept; + template< typename V, - Enable_if_t().x)>{}>* = nullptr> + Enable_if_t().x)>{}>* = nullptr> __device__ constexpr bool integer_unary_tests(const V&, const V&) { @@ -48,7 +51,7 @@ bool integer_unary_tests(const V&, const V&) { template< typename V, - Enable_if_t().x)>{}>* = nullptr> + Enable_if_t().x)>{}>* = nullptr> __device__ bool integer_unary_tests(V& f1, V& f2) { f1 %= f2; @@ -73,7 +76,7 @@ bool integer_unary_tests(V& f1, V& f2) { template< typename V, - Enable_if_t().x)>{}>* = nullptr> + Enable_if_t().x)>{}>* = nullptr> __device__ constexpr bool integer_binary_tests(const V&, const V&, const V&) { @@ -82,7 +85,7 @@ bool integer_binary_tests(const V&, const V&, const V&) { template< typename V, - Enable_if_t().x)>{}>* = nullptr> + Enable_if_t().x)>{}>* = nullptr> __device__ bool integer_binary_tests(V& f1, V& f2, V& f3) { f3 = f1 % f2; @@ -201,4 +204,4 @@ int main() { else { failed("Failed some vector test."); } -} \ No newline at end of file +}