Skip to content

Commit f5d08c5

Browse files
[SYCL] Fix sycl::span type deduction (#4970)
The sycl::span does not correctly deduce the type from an array argument. Here we fix this by adjusting the deduction guide to select the correct specialization (that has array support). The tests on llvm-test-suite are being updated as well. ( intel/llvm-test-suite#572 ) Signed-off-by: Chris Perkins <[email protected]>
1 parent 18e4cbb commit f5d08c5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sycl/include/CL/sycl/sycl_span.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,11 @@ as_writable_bytes(span<_Tp, _Extent> __s) noexcept
608608
}
609609

610610
// Deduction guides
611-
template <class _Tp, size_t _Sz> span(_Tp (&)[_Sz])->span<_Tp, _Sz>;
611+
612+
// array arg deduction guide. dynamic_extent arg used to select
613+
// the correct template. The _Sz will be used for the __size of the span.
614+
template <class _Tp, size_t _Sz>
615+
span(_Tp (&)[_Sz]) -> span<_Tp, dynamic_extent>;
612616

613617
template <class _Tp, size_t _Sz> span(std::array<_Tp, _Sz> &)->span<_Tp, _Sz>;
614618

0 commit comments

Comments
 (0)