@@ -48,6 +48,15 @@ struct is_ann_arg_impl<const annotated_arg<T, P>> : std::true_type {};
48
48
template <class T >
49
49
constexpr bool is_ann_arg_v =
50
50
is_ann_arg_impl<std::remove_reference_t <T>>::value;
51
+
52
+ template <class T > struct GetUnderlyingTImpl ;
53
+ template <class T , class P > struct GetUnderlyingTImpl <annotated_arg<T, P>> {
54
+ using type = T;
55
+ };
56
+ template <class T >
57
+ using GetUnderlyingT = typename GetUnderlyingTImpl<
58
+ std::remove_cv_t <std::remove_reference_t <T>>>::type;
59
+
51
60
} // namespace detail
52
61
53
62
// Deduction guide
@@ -220,6 +229,7 @@ template <typename T, typename... Props>
220
229
class __SYCL_SPECIAL_CLASS
221
230
__SYCL_TYPE (annotated_arg) annotated_arg<T, detail::properties_t<Props...>> {
222
231
using property_list_t = detail::properties_t <Props...>;
232
+ using UnderlyingT = T;
223
233
224
234
template <typename T2, typename PropertyListT> friend class annotated_arg ;
225
235
@@ -326,10 +336,11 @@ __SYCL_TYPE(annotated_arg) annotated_arg<T, detail::properties_t<Props...>> {
326
336
327
337
// propagate binary operators
328
338
#define PROPAGATE_OP (op ) \
329
- template <class O > \
330
- friend auto operator op (O &&a, const annotated_arg &b) \
331
- ->decltype (std::forward<O>(a) op std::declval<T>()) { \
332
- return std::forward<O>(a) op b.operator T (); \
339
+ template <class O > friend auto operator op (O &&a, const annotated_arg &b) { \
340
+ if constexpr (!detail::is_ann_arg_v<O>) \
341
+ return std::forward<O>(a) op b.operator T (); \
342
+ else \
343
+ return a.operator detail::GetUnderlyingT<O>() op b.operator T (); \
333
344
} \
334
345
template <class O , typename = std::enable_if_t <!detail::is_ann_arg_v<O>>> \
335
346
friend auto operator op (const annotated_arg &a, O &&b) \
0 commit comments