================
@@ -68,6 +68,22 @@ struct copyable {
~copyable();
};
+struct ref_arg_kernel_name;
+
+template <typename KernelName, typename KernelType>
+[[clang::sycl_kernel_entry_point(KernelName)]]
+void ref_arg_kernel(const KernelType &ref) {
+ ref(42);
+}
+
+struct rvalue_ref_arg_kernel_name;
+
+template <typename KernelName, typename KernelType>
+[[clang::sycl_kernel_entry_point(KernelName)]]
+void rvalue_ref_arg_kernel(KernelType &&ref) {
----------------
tahonermann wrote:
This doesn't validate an rvalue reference because `KernelType` is used in a
deduced context; this exercises a forwarding reference. C++ doesn't have a way
to declare a function parameter with an rvalue reference for a dependent type
without disabling deduction. I think that is fine though; we can just exercise
a forwarding reference here. But we should then do the following:
- Rename the function (e.g., `forwarding_ref_arg_kernel()`), and
- Pass `lambda` via `std::move()` (e.g, `static_cast<decltype(lambda)>(lambda)).
If we really want to test an rvalue reference type, we would have to declare
the function parameter as, e.g., `std::type_identity_t<KernelType>&&` and then
invoke the entry point as `rvalue_arg_ref_kernel<rvalue_ref_arg_kernel_name,
decltype(lambda)>(std::move(lambda))`.
https://github.com/llvm/llvm-project/pull/186788
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits