36 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// <atomic>10 11// typedef enum memory_order12// {13// memory_order_relaxed, memory_order_consume, memory_order_acquire,14// memory_order_release, memory_order_acq_rel, memory_order_seq_cst15// } memory_order;16 17#include <atomic>18#include <cassert>19 20#include "test_macros.h"21 22int main(int, char**)23{24 assert(static_cast<int>(std::memory_order_relaxed) == 0);25 assert(static_cast<int>(std::memory_order_consume) == 1);26 assert(static_cast<int>(std::memory_order_acquire) == 2);27 assert(static_cast<int>(std::memory_order_release) == 3);28 assert(static_cast<int>(std::memory_order_acq_rel) == 4);29 assert(static_cast<int>(std::memory_order_seq_cst) == 5);30 31 std::memory_order o = std::memory_order_seq_cst;32 assert(static_cast<int>(o) == 5);33 34 return 0;35}36