Skip to content

Commit a905a27

Browse files
authored
[SYCL] Fix buffer creation from rvalue iterator (#5609)
Use pointer to iterator instead of pointer to underlining data as host pointer in XPTI notification.
1 parent ab1e594 commit a905a27

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

sycl/include/CL/sycl/buffer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class buffer {
236236
make_unique_ptr<detail::SYCLMemObjAllocatorHolder<AllocatorT>>(
237237
allocator));
238238
size_t r[3] = {Range[0], 0, 0};
239-
impl->constructorNotification(CodeLoc, (void *)impl.get(), &*first,
239+
impl->constructorNotification(CodeLoc, (void *)impl.get(), &first,
240240
(const void *)typeid(T).name(), dimensions,
241241
sizeof(T), r);
242242
}
@@ -253,7 +253,7 @@ class buffer {
253253
propList,
254254
make_unique_ptr<detail::SYCLMemObjAllocatorHolder<AllocatorT>>());
255255
size_t r[3] = {Range[0], 0, 0};
256-
impl->constructorNotification(CodeLoc, (void *)impl.get(), &*first,
256+
impl->constructorNotification(CodeLoc, (void *)impl.get(), &first,
257257
(const void *)typeid(T).name(), dimensions,
258258
sizeof(T), r);
259259
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %clangxx %fsycl-host-only -fsyntax-only -sycl-std=2020 -Xclang -verify -Xclang -verify-ignore-unexpected=note %s -o %t.out
2+
// expected-no-diagnostics
3+
4+
#include <CL/sycl.hpp>
5+
6+
int main() {
7+
std::vector<int> v(1);
8+
std::move_iterator it1(v.begin());
9+
std::move_iterator it2(v.end());
10+
cl::sycl::buffer b1(it1, it2);
11+
return 0;
12+
}

0 commit comments

Comments
 (0)