This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.

3999. P0439R0 changed the value category of memory order constants

Section: 32.5.4 [atomics.order] Status: New Submitter: Jiang An Opened: 2023-10-18 Last modified: 2023-11-03

Priority: 4

View other active issues in [atomics.order].

View all other issues in [atomics.order].

View all issues with New status.

Discussion:

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.

[2023-11-02; Reflector poll]

Set priority to 4 after reflector poll.

Proposed resolution:

This wording is relative to N4964.

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

    namespace std {
      // 32.5.4 [atomics.order], order and consistency
      enum class memory_order : unspecified;                        // freestanding
      inline constexpr memory_order memory_order_relaxed = memory_order::relaxed; // freestanding
      inline constexpr memory_order memory_order_consume = memory_order::consume; // freestanding
      inline constexpr memory_order memory_order_acquire = memory_order::acquire; // freestanding
      inline constexpr memory_order memory_order_release = memory_order::release; // freestanding
      inline constexpr memory_order memory_order_acq_rel = memory_order::acq_rel; // freestanding
      inline constexpr memory_order memory_order_seq_cst = memory_order::seq_cst; // freestanding
      
      […]
    }
    […]
    
  2. Modify 32.5.4 [atomics.order] as indicated:

    namespace std {
      enum class memory_order : unspecified {
        relaxed, consume, acquire, release, acq_rel, seq_cst
      };
    }