Skip to content

[SYCL] Return static to has_property and get_property methods #4240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions sycl/include/sycl/ext/oneapi/accessor_property_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,18 @@ class accessor_property_list : protected sycl::detail::PropertyListBase {

#if __cplusplus >= 201703L
template <typename T>
constexpr std::enable_if_t<is_compile_time_property<T>::value, bool>
has_property() const {
static constexpr bool has_property(
typename std::enable_if_t<is_compile_time_property<T>::value> * = 0) {
return ContainsPropertyInstance<PropertyContainer<PropsT...>,
T::template instance>::value;
}

template <typename T,
typename = std::enable_if_t<
is_compile_time_property<T>::value &&
ContainsPropertyInstance<PropertyContainer<PropsT...>,
T::template instance>::value>>
constexpr auto get_property() const {
template <typename T>
static constexpr auto get_property(
typename std::enable_if_t<
is_compile_time_property<T>::value &&
ContainsPropertyInstance<PropertyContainer<PropsT...>,
T::template instance>::value> * = 0) {
return typename GetCompileTimePropertyHelper<PropertyContainer<PropsT...>,
T::template instance>::type{};
}
Expand Down
16 changes: 16 additions & 0 deletions sycl/test/regression/check_static_property.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s
// expected-no-diagnostics

#include <CL/sycl.hpp>

int main() {
sycl::ext::oneapi::accessor_property_list PL{sycl::ext::oneapi::no_alias};
static_assert(
decltype(PL)::has_property<sycl::ext::oneapi::property::no_alias>(),
"Property is not found");
static_assert(
decltype(PL)::get_property<sycl::ext::oneapi::property::no_alias>() ==
sycl::ext::oneapi::no_alias,
"Properties are not equal");
return 0;
}