From 6bb9831e91439c3e3a7fe9b37f44d253ab22c056 Mon Sep 17 00:00:00 2001 From: Severin Leonhardt Date: Fri, 23 Sep 2022 12:48:21 +0200 Subject: [PATCH] Adapt MemoryOrder definition for C++ 20 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When compiling the code with C++ 20 the following error message is produced: enumerator value for ‘MEMORY_ORDER_RELAXED’ must have integral or unscoped enumeration type This is because with C++ 20 the type of those values changed to an enum class. The `static_cast` extracts the numeric values so they can be used here as before. --- src/atomic/atomic_std.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/atomic/atomic_std.hpp b/src/atomic/atomic_std.hpp index 2ad01034e..1a23cc1b1 100644 --- a/src/atomic/atomic_std.hpp +++ b/src/atomic/atomic_std.hpp @@ -22,12 +22,12 @@ namespace datastax { namespace internal { enum MemoryOrder { - MEMORY_ORDER_RELAXED = std::memory_order_relaxed, - MEMORY_ORDER_CONSUME = std::memory_order_consume, - MEMORY_ORDER_ACQUIRE = std::memory_order_acquire, - MEMORY_ORDER_RELEASE = std::memory_order_release, - MEMORY_ORDER_ACQ_REL = std::memory_order_acq_rel, - MEMORY_ORDER_SEQ_CST = std::memory_order_seq_cst + MEMORY_ORDER_RELAXED = static_cast::type>(std::memory_order_relaxed), + MEMORY_ORDER_CONSUME = static_cast::type>(std::memory_order_consume), + MEMORY_ORDER_ACQUIRE = static_cast::type>(std::memory_order_acquire), + MEMORY_ORDER_RELEASE = static_cast::type>(std::memory_order_release), + MEMORY_ORDER_ACQ_REL = static_cast::type>(std::memory_order_acq_rel), + MEMORY_ORDER_SEQ_CST = static_cast::type>(std::memory_order_seq_cst) }; template