Skip to content

Commit fbad42a

Browse files
authored
[SYCL] annotated_ptr API fixes part 2 (#10928)
Remove `operator=(const T*)`. This one isn't deprecated because it was broken (trying to return temp as reference) and therefore can't have users. Also add missing `const` for copy constructor.
1 parent 8f75531 commit fbad42a

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_annotated_ptr.asciidoc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,6 @@ class annotated_ptr {
288288
289289
T* get() const noexcept;
290290
291-
annotated_ptr& operator=(T*) noexcept;
292291
annotated_ptr& operator=(const annotated_ptr&) noexcept = default;
293292
294293
annotated_ptr& operator++() noexcept;
@@ -447,15 +446,6 @@ T* get() const noexcept;
447446
Returns the underlying raw pointer. The raw pointer will not retain the
448447
annotations.
449448

450-
// --- ROW BREAK ---
451-
a|
452-
[source,c++]
453-
----
454-
annotated_ptr& operator=(T*) noexcept;
455-
----
456-
|
457-
Allows assignment from a pointer to type `T`.
458-
459449
// --- ROW BREAK ---
460450
a|
461451
[source,c++]

sycl/include/sycl/ext/oneapi/experimental/annotated_ptr/annotated_ptr.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ __SYCL_TYPE(annotated_ptr) annotated_ptr<T, detail::properties_t<Props...>> {
238238

239239
annotated_ptr() noexcept = default;
240240
annotated_ptr(const annotated_ptr &) = default;
241-
annotated_ptr &operator=(annotated_ptr &) = default;
241+
annotated_ptr &operator=(const annotated_ptr &) = default;
242242

243243
annotated_ptr(T *Ptr, const property_list_t & = properties{}) noexcept
244244
: m_Ptr(global_pointer_t(Ptr)) {}
@@ -321,10 +321,6 @@ __SYCL_TYPE(annotated_ptr) annotated_ptr<T, detail::properties_t<Props...>> {
321321

322322
T *get() const noexcept { return m_Ptr; }
323323

324-
annotated_ptr &operator=(T *) noexcept {
325-
return annotated_ptr<T, property_list_t>(m_Ptr);
326-
}
327-
328324
annotated_ptr &operator++() noexcept {
329325
m_Ptr += 1;
330326
return *this;

sycl/test/extensions/annotated_arg/annotated_ptr.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ void TestVectorAddWithAnnotatedMMHosts() {
110110
// annotated_ptr<int, decltype(properties{dwidth<32>})> arg24(tmp21,
111111
// properties{dwidth<32>}); // ERR
112112

113+
// Implicit conversion
114+
a1 = raw;
115+
113116
// Property merge
114117
auto arg31 = annotated_ptr_t3(raw, buffer_location<0>, awidth<32>); // OK
115118
auto arg32 = annotated_ptr(arg31, properties{dwidth<32>}); // OK

0 commit comments

Comments
 (0)