From 1402ba401757ab82531ce3ffda2f006a3619fb47 Mon Sep 17 00:00:00 2001 From: Ivan Karachun Date: Wed, 29 Jul 2020 12:34:56 +0300 Subject: [PATCH 1/2] [SYCL] Fixed check for set_arg Need to get rid of CV-qualifiers and references before checking for is_trivially_copyable and is_standard_layout. Signed-off-by: Ivan Karachun --- sycl/include/CL/sycl/handler.hpp | 4 ++-- sycl/test/basic_tests/set_arg_error.cpp | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/sycl/include/CL/sycl/handler.hpp b/sycl/include/CL/sycl/handler.hpp index 982250a52879b..dbb5c416d3ab1 100644 --- a/sycl/include/CL/sycl/handler.hpp +++ b/sycl/include/CL/sycl/handler.hpp @@ -805,9 +805,9 @@ class __SYCL_EXPORT handler { template struct ShouldEnableSetArg { static constexpr bool value = - std::is_trivially_copyable::value + std::is_trivially_copyable>::value #if CL_SYCL_LANGUAGE_VERSION && CL_SYCL_LANGUAGE_VERSION <= 121 - && std::is_standard_layout::value + && std::is_standard_layout>::value #endif || is_same_type::value // Sampler || (!is_same_type::value && diff --git a/sycl/test/basic_tests/set_arg_error.cpp b/sycl/test/basic_tests/set_arg_error.cpp index 4472b50bcd669..52df555902b44 100644 --- a/sycl/test/basic_tests/set_arg_error.cpp +++ b/sycl/test/basic_tests/set_arg_error.cpp @@ -33,15 +33,23 @@ int main() { cl::sycl::accessor local_acc({size}, h); + TriviallyCopyable tc{1, 2}; + NonTriviallyCopyable ntc; h.set_arg(0, local_acc); h.set_arg(1, global_acc); h.set_arg(2, samp); - h.set_arg(3, TriviallyCopyable{}); + h.set_arg(3, tc); + h.set_arg(4, TriviallyCopyable{}); + h.set_arg( // expected-error {{no matching member function for call to 'set_arg'}} + 5, ntc); h.set_arg( // expected-error {{no matching member function for call to 'set_arg'}} 4, NonTriviallyCopyable{}); #if CL_SYCL_LANGUAGE_VERSION && CL_SYCL_LANGUAGE_VERSION <= 121 + NonStdLayout nstd; + h.set_arg( // expected-error {{no matching member function for call to 'set_arg'}} + 6, nstd); h.set_arg( // expected-error {{no matching member function for call to 'set_arg'}} - 5, NonStdLayout{}); + 7, NonStdLayout{}); #endif }); } From e50ce25773bc41ec24bda76a2e5eb7fb439f0972 Mon Sep 17 00:00:00 2001 From: Ivan Karachun Date: Wed, 29 Jul 2020 14:24:41 +0300 Subject: [PATCH 2/2] Remove reference only Signed-off-by: Ivan Karachun --- sycl/include/CL/sycl/handler.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sycl/include/CL/sycl/handler.hpp b/sycl/include/CL/sycl/handler.hpp index dbb5c416d3ab1..a675f8aa66a0f 100644 --- a/sycl/include/CL/sycl/handler.hpp +++ b/sycl/include/CL/sycl/handler.hpp @@ -805,9 +805,9 @@ class __SYCL_EXPORT handler { template struct ShouldEnableSetArg { static constexpr bool value = - std::is_trivially_copyable>::value + std::is_trivially_copyable>::value #if CL_SYCL_LANGUAGE_VERSION && CL_SYCL_LANGUAGE_VERSION <= 121 - && std::is_standard_layout>::value + && std::is_standard_layout>::value #endif || is_same_type::value // Sampler || (!is_same_type::value &&