Skip to content

[SYCL] Add workaround for undeterminable constexpr lambda return #19191

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 1 commit into from
Jun 27, 2025
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
4 changes: 2 additions & 2 deletions sycl/include/sycl/ext/oneapi/properties/properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ using properties_t =
properties<detail::properties_type_list<PropertyValueTs...>>;

template <typename... property_tys>
inline constexpr bool properties_are_unique = []() constexpr {
inline constexpr bool properties_are_unique = []() constexpr -> bool {
if constexpr (sizeof...(property_tys) == 0) {
return true;
} else {
Expand All @@ -64,7 +64,7 @@ inline constexpr bool properties_are_unique = []() constexpr {
}();

template <typename... property_tys>
inline constexpr bool properties_are_sorted = []() constexpr {
inline constexpr bool properties_are_sorted = []() constexpr -> bool {
if constexpr (sizeof...(property_tys) == 0) {
return true;
} else {
Expand Down
2 changes: 1 addition & 1 deletion sycl/include/sycl/ext/oneapi/properties/property.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ struct property_base : property_key_tag<property_key_t> {
// Temporary, to ensure new code matches previous behavior and to catch any
// silly copy-paste mistakes. MSVC can't compile it, but linux-only is
// enough for this temporary check.
static_assert([]() constexpr {
static_assert([]() constexpr -> bool {
if constexpr (std::is_same_v<property_t, key_t>)
// key_t is incomplete at this point for runtime properties.
return true;
Expand Down
15 changes: 15 additions & 0 deletions sycl/test/regression/grf_properties_wa.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// RUN: %clangxx -fsycl -fsyntax-only %s

// Test for a workaround to a bug in clang causing some constexpr lambda
// expressions to not be identified as returning a bool.

#include <sycl/detail/kernel_properties.hpp>
#include <sycl/ext/intel/experimental/grf_size_properties.hpp>
#include <sycl/sycl.hpp>

int main() {
if constexpr (false) {
sycl::ext::oneapi::experimental::properties prop{
sycl::ext::intel::experimental::grf_size<256>};
}
}