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-exception
6//
7//===----------------------------------------------------------------------===//
8
9// <atomic>
10
11// typedef atomic<char> atomic_char;
12// typedef atomic<signed char> atomic_schar;
13// typedef atomic<unsigned char> atomic_uchar;
14// typedef atomic<short> atomic_short;
15// typedef atomic<unsigned short> atomic_ushort;
16// typedef atomic<int> atomic_int;
17// typedef atomic<unsigned int> atomic_uint;
18// typedef atomic<long> atomic_long;
19// typedef atomic<unsigned long> atomic_ulong;
20// typedef atomic<long long> atomic_llong;
21// typedef atomic<unsigned long long> atomic_ullong;
22// typedef atomic<char8_t> atomic_char8_t; // C++20
23// typedef atomic<char16_t> atomic_char16_t;
24// typedef atomic<char32_t> atomic_char32_t;
25// typedef atomic<wchar_t> atomic_wchar_t;
26//
27// typedef atomic<intptr_t> atomic_intptr_t;
28// typedef atomic<uintptr_t> atomic_uintptr_t;
29//
30// typedef atomic<int8_t> atomic_int8_t;
31// typedef atomic<uint8_t> atomic_uint8_t;
32// typedef atomic<int16_t> atomic_int16_t;
33// typedef atomic<uint16_t> atomic_uint16_t;
34// typedef atomic<int32_t> atomic_int32_t;
35// typedef atomic<uint32_t> atomic_uint32_t;
36// typedef atomic<int64_t> atomic_int64_t;
37// typedef atomic<uint64_t> atomic_uint64_t;
38
39#include <atomic>
40#include <type_traits>
41
42#include "test_macros.h"
43
44int main(int, char**)
45{
46 static_assert((std::is_same<std::atomic<char>, std::atomic_char>::value), "");
47 static_assert((std::is_same<std::atomic<signed char>, std::atomic_schar>::value), "");
48 static_assert((std::is_same<std::atomic<unsigned char>, std::atomic_uchar>::value), "");
49 static_assert((std::is_same<std::atomic<short>, std::atomic_short>::value), "");
50 static_assert((std::is_same<std::atomic<unsigned short>, std::atomic_ushort>::value), "");
51 static_assert((std::is_same<std::atomic<int>, std::atomic_int>::value), "");
52 static_assert((std::is_same<std::atomic<unsigned int>, std::atomic_uint>::value), "");
53 static_assert((std::is_same<std::atomic<long>, std::atomic_long>::value), "");
54 static_assert((std::is_same<std::atomic<unsigned long>, std::atomic_ulong>::value), "");
55 static_assert((std::is_same<std::atomic<long long>, std::atomic_llong>::value), "");
56 static_assert((std::is_same<std::atomic<unsigned long long>, std::atomic_ullong>::value), "");
57#ifndef TEST_HAS_NO_WIDE_CHARACTERS
58 static_assert((std::is_same<std::atomic<wchar_t>, std::atomic_wchar_t>::value), "");
59#endif
60#if TEST_STD_VER > 17 && defined(__cpp_char8_t)
61 static_assert((std::is_same<std::atomic<char8_t>, std::atomic_char8_t>::value), "");
62#endif
63 static_assert((std::is_same<std::atomic<char16_t>, std::atomic_char16_t>::value), "");
64 static_assert((std::is_same<std::atomic<char32_t>, std::atomic_char32_t>::value), "");
65
66// Added by LWG 2441
67 static_assert((std::is_same<std::atomic<std::intptr_t>, std::atomic_intptr_t>::value), "");
68 static_assert((std::is_same<std::atomic<std::uintptr_t>, std::atomic_uintptr_t>::value), "");
69
70 static_assert((std::is_same<std::atomic<int8_t>, std::atomic_int8_t>::value), "");
71 static_assert((std::is_same<std::atomic<uint8_t>, std::atomic_uint8_t>::value), "");
72 static_assert((std::is_same<std::atomic<int16_t>, std::atomic_int16_t>::value), "");
73 static_assert((std::is_same<std::atomic<uint16_t>, std::atomic_uint16_t>::value), "");
74 static_assert((std::is_same<std::atomic<int32_t>, std::atomic_int32_t>::value), "");
75 static_assert((std::is_same<std::atomic<uint32_t>, std::atomic_uint32_t>::value), "");
76 static_assert((std::is_same<std::atomic<int64_t>, std::atomic_int64_t>::value), "");
77 static_assert((std::is_same<std::atomic<uint64_t>, std::atomic_uint64_t>::value), "");
78
79 return 0;
80}
81

source code of libcxx/test/std/atomics/atomics.types.generic/integral_typedefs.pass.cpp