Skip to content

Commit a635873

Browse files
authored
[SYCL] Resolve name clash with a user defined symbol (#4570)
Used fully qualified name in DPC++ headers to avoid conflicts with user defined symbols.
1 parent c641166 commit a635873

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

sycl/include/CL/sycl/sycl_span.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ template <typename _Tp, size_t _Extent> class _SYCL_SPAN_TEMPLATE_VIS span {
227227
_SYCL_SPAN_INLINE_VISIBILITY constexpr explicit span(pointer __f, pointer __l)
228228
: __data{__f} {
229229
(void)__l;
230-
_SYCL_SPAN_ASSERT(_Extent == distance(__f, __l),
230+
_SYCL_SPAN_ASSERT(_Extent == std::distance(__f, __l),
231231
"size mismatch in span's constructor (ptr, ptr)");
232232
}
233233

@@ -428,7 +428,7 @@ class _SYCL_SPAN_TEMPLATE_VIS span<_Tp, dynamic_extent> {
428428
_SYCL_SPAN_INLINE_VISIBILITY constexpr span(pointer __ptr, size_type __count)
429429
: __data{__ptr}, __size{__count} {}
430430
_SYCL_SPAN_INLINE_VISIBILITY constexpr span(pointer __f, pointer __l)
431-
: __data{__f}, __size{static_cast<size_t>(distance(__f, __l))} {}
431+
: __data{__f}, __size{static_cast<size_t>(std::distance(__f, __l))} {}
432432

433433
template <size_t _Sz>
434434
_SYCL_SPAN_INLINE_VISIBILITY constexpr span(

sycl/test/regression/macro_conflict.cpp renamed to sycl/test/regression/headers_conflict.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
//===----------------------------------------------------------------------===//
99

1010
#define SUCCESS 0
11+
class distance;
1112

1213
#include <CL/sycl.hpp>

0 commit comments

Comments
 (0)