Skip to content

Commit 115b84e

Browse files
jaladreipsvmaksimo
authored andcommitted
Explicitly cast OCLMemOrderKind members from std::memory_order in C++20 case (#3254)
Clang does not like the current way of directly assigning members of one enum to another and requires explicit static_cast on the way. Compilation failed: https://godbolt.org/z/3PYqsETdc Compilation successful: https://godbolt.org/z/bjeYK376s Original commit: KhronosGroup/SPIRV-LLVM-Translator@58512e7004967b9
1 parent 14e9f00 commit 115b84e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm-spirv/lib/SPIRV/OCLUtil.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ enum OCLScopeKind {
9999
// the corresponding constants from 'std::memory_order' enum.
100100
enum OCLMemOrderKind {
101101
#if __cplusplus >= 202002L
102-
OCLMO_relaxed = std::memory_order_relaxed,
103-
OCLMO_acquire = std::memory_order_acquire,
104-
OCLMO_release = std::memory_order_release,
105-
OCLMO_acq_rel = std::memory_order_acq_rel,
106-
OCLMO_seq_cst = std::memory_order_seq_cst
102+
OCLMO_relaxed = static_cast<int>(std::memory_order::relaxed),
103+
OCLMO_acquire = static_cast<int>(std::memory_order::acquire),
104+
OCLMO_release = static_cast<int>(std::memory_order::release),
105+
OCLMO_acq_rel = static_cast<int>(std::memory_order::acq_rel),
106+
OCLMO_seq_cst = static_cast<int>(std::memory_order::seq_cst)
107107
#else
108108
OCLMO_relaxed = std::memory_order::memory_order_relaxed,
109109
OCLMO_acquire = std::memory_order::memory_order_acquire,

0 commit comments

Comments
 (0)