Skip to content

Commit 43336a1

Browse files
authored
[SYCL] annotated_ptr API fixes part 3 (#10936)
Deprecate implicit constructor by marking constructor explicit and adding new deprecated implicit constructor. This is separate because it won't be included in 2024.0.
1 parent 5c53acd commit 43336a1

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_annotated_ptr.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,9 @@ class annotated_ptr {
262262
using reference = annotated_ref<T, PropertyListT>;
263263
264264
annotated_ptr() noexcept;
265-
annotated_ptr(T *Ptr, const PropertyListT &P = properties{}) noexcept;
265+
explicit annotated_ptr(T *Ptr, const PropertyListT &P = properties{}) noexcept;
266266
template<typename... PropertyValueTs>
267-
annotated_ptr(T *Ptr, PropertyValueTs... props) noexcept;
267+
explicit annotated_ptr(T *Ptr, PropertyValueTs... props) noexcept;
268268
269269
template <typename T2, typename P> explicit annotated_ptr(
270270
const annotated_ptr<T2, P>&) noexcept;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,16 @@ __SYCL_TYPE(annotated_ptr) annotated_ptr<T, detail::properties_t<Props...>> {
205205
annotated_ptr(const annotated_ptr &) = default;
206206
annotated_ptr &operator=(const annotated_ptr &) = default;
207207

208-
annotated_ptr(T *Ptr, const property_list_t & = properties{}) noexcept
208+
explicit annotated_ptr(T *Ptr,
209+
const property_list_t & = properties{}) noexcept
209210
: m_Ptr(global_pointer_t(Ptr)) {}
210211

211212
// Constructs an annotated_ptr object from a raw pointer and variadic
212213
// properties. The new property set contains all properties of the input
213214
// variadic properties. The same property in `Props...` and
214215
// `PropertyValueTs...` must have the same property value.
215216
template <typename... PropertyValueTs>
216-
annotated_ptr(T *Ptr, const PropertyValueTs &...props) noexcept
217+
explicit annotated_ptr(T *Ptr, const PropertyValueTs &...props) noexcept
217218
: m_Ptr(global_pointer_t(Ptr)) {
218219
static_assert(
219220
std::is_same<

sycl/test/extensions/annotated_arg/annotated_ptr.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fsyntax-only -Xclang -verify -Xclang -verify-ignore-unexpected=note %s
2-
// expected-no-diagnostics
32

43
#include "sycl/sycl.hpp"
54
#include <sycl/ext/intel/fpga_extensions.hpp>
@@ -110,7 +109,9 @@ void TestVectorAddWithAnnotatedMMHosts() {
110109
// annotated_ptr<int, decltype(properties{dwidth<32>})> arg24(tmp21,
111110
// properties{dwidth<32>}); // ERR
112111

113-
// Implicit conversion
112+
// Removed
113+
// Assignment / implicit conversion
114+
// expected-error@+1 {{no viable overloaded '='}}
114115
a1 = raw;
115116

116117
// Property merge

0 commit comments

Comments
 (0)