Skip to content

Commit f387c5a

Browse files
[SYCL] Return static to has_property and get_property methods (#4240)
Fix regression related to missing static identifier for has_property and get_property methods. Without a static identifier, errors occur in the previously valid code.
1 parent da138cc commit f387c5a

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

sycl/include/sycl/ext/oneapi/accessor_property_list.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,18 @@ class accessor_property_list : protected sycl::detail::PropertyListBase {
195195

196196
#if __cplusplus >= 201703L
197197
template <typename T>
198-
constexpr std::enable_if_t<is_compile_time_property<T>::value, bool>
199-
has_property() const {
198+
static constexpr bool has_property(
199+
typename std::enable_if_t<is_compile_time_property<T>::value> * = 0) {
200200
return ContainsPropertyInstance<PropertyContainer<PropsT...>,
201201
T::template instance>::value;
202202
}
203203

204-
template <typename T,
205-
typename = std::enable_if_t<
206-
is_compile_time_property<T>::value &&
207-
ContainsPropertyInstance<PropertyContainer<PropsT...>,
208-
T::template instance>::value>>
209-
constexpr auto get_property() const {
204+
template <typename T>
205+
static constexpr auto get_property(
206+
typename std::enable_if_t<
207+
is_compile_time_property<T>::value &&
208+
ContainsPropertyInstance<PropertyContainer<PropsT...>,
209+
T::template instance>::value> * = 0) {
210210
return typename GetCompileTimePropertyHelper<PropertyContainer<PropsT...>,
211211
T::template instance>::type{};
212212
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s
2+
// expected-no-diagnostics
3+
4+
#include <CL/sycl.hpp>
5+
6+
int main() {
7+
sycl::ext::oneapi::accessor_property_list PL{sycl::ext::oneapi::no_alias};
8+
static_assert(
9+
decltype(PL)::has_property<sycl::ext::oneapi::property::no_alias>(),
10+
"Property is not found");
11+
static_assert(
12+
decltype(PL)::get_property<sycl::ext::oneapi::property::no_alias>() ==
13+
sycl::ext::oneapi::no_alias,
14+
"Properties are not equal");
15+
return 0;
16+
}

0 commit comments

Comments
 (0)