From d2cfe2078473638e8f8c8b6cee2d4ea6350fe519 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Mon, 30 Sep 2019 19:05:01 -0700 Subject: [PATCH] Implement LWG 3268's PR to fix #150. This is a back-compat fix for users who were saying things like `std::memory_order::memory_order_relaxed`. As there is nothing especially problematic about such usage, and LWG's ultimate resolution is unknown, I'm not deprecating these enumerators at this time. If and when this is voted into the WP in the deprecated clause, then we can add deprecated attributes. This mirrors a Microsoft-internal PR: https://devdiv.visualstudio.com/DevDiv/_git/msvc/pullrequest/205250 --- stl/inc/xatomic.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/stl/inc/xatomic.h b/stl/inc/xatomic.h index 1562df01000..9fe96dd70cf 100644 --- a/stl/inc/xatomic.h +++ b/stl/inc/xatomic.h @@ -57,7 +57,22 @@ _STD_BEGIN #if _HAS_CXX20 // ENUM CLASS memory_order -enum class memory_order : int { relaxed, consume, acquire, release, acq_rel, seq_cst }; +enum class memory_order : int { + relaxed, + consume, + acquire, + release, + acq_rel, + seq_cst, + + // LWG 3268 + memory_order_relaxed = relaxed, + memory_order_consume = consume, + memory_order_acquire = acquire, + memory_order_release = release, + memory_order_acq_rel = acq_rel, + memory_order_seq_cst = seq_cst +}; inline constexpr memory_order memory_order_relaxed = memory_order::relaxed; inline constexpr memory_order memory_order_consume = memory_order::consume; inline constexpr memory_order memory_order_acquire = memory_order::acquire;