Skip to content

Commit 10d2f5b

Browse files
authored
Adds explicit conversion of multi_ptr<T> to multi_ptr<const T>. (#9750)
This ctor has been previously removed, as it had conflict with existing ones. Not having the ctor produces failures to compile some cts tests. An investigation is required.
1 parent fa501fd commit 10d2f5b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sycl/include/sycl/multi_ptr.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,16 @@ class multi_ptr {
113113
: m_Pointer(ptr) {}
114114
multi_ptr(std::nullptr_t) : m_Pointer(nullptr) {}
115115

116+
// Explicit conversion from multi_ptr<T> to multi_ptr<const T>
117+
template <typename NonConstElementType = std::remove_const_t<ElementType>,
118+
typename = typename std::enable_if_t<
119+
std::is_const_v<ElementType> &&
120+
std::is_same_v<NonConstElementType,
121+
std::remove_const_t<ElementType>>>>
122+
explicit multi_ptr(
123+
multi_ptr<NonConstElementType, Space, DecorateAddress> MPtr)
124+
: m_Pointer(MPtr.get_decorated()) {}
125+
116126
// Only if Space is in
117127
// {global_space, ext_intel_global_device_space, generic_space}
118128
template <

0 commit comments

Comments
 (0)