Title
P0439R0 changed the value category of memory order constants
Status
new
Section
[atomics.order]
Submitter
Jiang An

Created on 2023-10-18.00:00:00 last changed 13 months ago

Messages

Date: 2023-11-03.18:08:28

Proposed resolution:

This wording is relative to N4964.

  1. Modify [atomics.syn], header <atomic> synopsis, as indicated:

    namespace std {
      // [atomics.order], order and consistency
      enum class memory_order : unspecified;                        // freestanding
      inline constexpr memory_order memory_order_relaxed = memory_order::relaxedusing memory_order::memory_order_relaxed; // freestanding
      inline constexpr memory_order memory_order_consume = memory_order::consumeusing memory_order::memory_order_consume; // freestanding
      inline constexpr memory_order memory_order_acquire = memory_order::acquireusing memory_order::memory_order_acquire; // freestanding
      inline constexpr memory_order memory_order_release = memory_order::releaseusing memory_order::memory_order_release; // freestanding
      inline constexpr memory_order memory_order_acq_rel = memory_order::acq_relusing memory_order::memory_order_acq_rel; // freestanding
      inline constexpr memory_order memory_order_seq_cst = memory_order::seq_cstusing memory_order::memory_order_seq_cst; // freestanding
      
      […]
    }
    […]
    
  2. Modify [atomics.order] as indicated:

    namespace std {
      enum class memory_order : unspecified {
        relaxed, consume, acquire, release, acq_rel, seq_cst,
        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
      };
    }
Date: 2023-11-15.00:00:00

[ 2023-11-02; Reflector poll ]

Set priority to 4 after reflector poll.

Date: 2023-10-18.00:00:00

P0439R0 made std::memory_order an scoped enumeration type. However, it also changed former enumerators (std::memory_order_seq_cst) to constexpr variables.

It is unclear the additional change is intended while it presumably bothered nobody in practice. Given there is using enum (P1099R5) in C++20, it may be better to keep these constants being prvalues.

History
Date User Action Args
2023-11-03 18:08:28adminsetmessages: + msg13811
2023-10-21 10:13:56adminsetmessages: + msg13761
2023-10-18 00:00:00admincreate