Skip to content

Commit a8ca5bf

Browse files
[SYCL] Cast PropKind boundary in properties mock tests (#6150)
To avoid ambiguous operators in the mock properties, the boundary of PropKind, i.e. PropKind::PropKindSize, is cast to its integer representation before doing arithmetic operations with it. Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
1 parent a37c10b commit a8ca5bf

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

sycl/test/extensions/properties/mock_compile_time_properties.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,28 +103,28 @@ struct is_property_key_of<fir_key, syclObjectT> : std::true_type {};
103103

104104
namespace detail {
105105
template <> struct PropertyToKind<bar_key> {
106-
static constexpr PropKind Kind =
107-
static_cast<enum PropKind>(PropKind::PropKindSize + 0);
106+
static constexpr PropKind Kind = static_cast<enum PropKind>(
107+
static_cast<std::uint32_t>(PropKind::PropKindSize) + 0);
108108
};
109109
template <> struct PropertyToKind<baz_key> {
110-
static constexpr PropKind Kind =
111-
static_cast<enum PropKind>(PropKind::PropKindSize + 1);
110+
static constexpr PropKind Kind = static_cast<enum PropKind>(
111+
static_cast<std::uint32_t>(PropKind::PropKindSize) + 1);
112112
};
113113
template <> struct PropertyToKind<foo_key> {
114-
static constexpr PropKind Kind =
115-
static_cast<enum PropKind>(PropKind::PropKindSize + 2);
114+
static constexpr PropKind Kind = static_cast<enum PropKind>(
115+
static_cast<std::uint32_t>(PropKind::PropKindSize) + 2);
116116
};
117117
template <> struct PropertyToKind<boo_key> {
118-
static constexpr PropKind Kind =
119-
static_cast<enum PropKind>(PropKind::PropKindSize + 3);
118+
static constexpr PropKind Kind = static_cast<enum PropKind>(
119+
static_cast<std::uint32_t>(PropKind::PropKindSize) + 3);
120120
};
121121
template <> struct PropertyToKind<foz_key> {
122-
static constexpr PropKind Kind =
123-
static_cast<enum PropKind>(PropKind::PropKindSize + 4);
122+
static constexpr PropKind Kind = static_cast<enum PropKind>(
123+
static_cast<std::uint32_t>(PropKind::PropKindSize) + 4);
124124
};
125125
template <> struct PropertyToKind<fir_key> {
126-
static constexpr PropKind Kind =
127-
static_cast<enum PropKind>(PropKind::PropKindSize + 4);
126+
static constexpr PropKind Kind = static_cast<enum PropKind>(
127+
static_cast<std::uint32_t>(PropKind::PropKindSize) + 4);
128128
};
129129

130130
template <> struct IsCompileTimeProperty<bar_key> : std::true_type {};

0 commit comments

Comments
 (0)