Skip to content

Commit 401d174

Browse files
authored
[SYCL] Change which constructor is gated for devices (#1183)
Signed-off-by: James Brodman <[email protected]>
1 parent 45e39bd commit 401d174

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

sycl/include/CL/sycl/multi_ptr.hpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,36 @@ template <typename ElementType, access::address_space Space> class multi_ptr {
4444
multi_ptr() : m_Pointer(nullptr) {}
4545
multi_ptr(const multi_ptr &rhs) = default;
4646
multi_ptr(multi_ptr &&) = default;
47-
multi_ptr(pointer_t pointer) : m_Pointer(pointer) {}
4847
#ifdef __SYCL_DEVICE_ONLY__
48+
multi_ptr(pointer_t pointer) : m_Pointer(pointer) {}
49+
#endif
50+
4951
multi_ptr(ElementType *pointer) : m_Pointer((pointer_t)(pointer)) {
5052
// TODO An implementation should reject an argument if the deduced
5153
// address space is not compatible with Space.
5254
}
53-
#endif
55+
5456
multi_ptr(std::nullptr_t) : m_Pointer(nullptr) {}
5557
~multi_ptr() = default;
5658

5759
// Assignment and access operators
5860
multi_ptr &operator=(const multi_ptr &) = default;
5961
multi_ptr &operator=(multi_ptr &&) = default;
62+
63+
#ifdef __SYCL_DEVICE_ONLY__
6064
multi_ptr &operator=(pointer_t pointer) {
6165
m_Pointer = pointer;
6266
return *this;
6367
}
64-
#ifdef __SYCL_DEVICE_ONLY__
68+
#endif
69+
6570
multi_ptr &operator=(ElementType *pointer) {
6671
// TODO An implementation should reject an argument if the deduced
6772
// address space is not compatible with Space.
6873
m_Pointer = (pointer_t)pointer;
6974
return *this;
7075
}
71-
#endif
76+
7277
multi_ptr &operator=(std::nullptr_t) {
7378
m_Pointer = nullptr;
7479
return *this;

0 commit comments

Comments
 (0)