| 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 <cstdint> |
| 41 | #include <type_traits> |
| 42 | |
| 43 | #include "test_macros.h" |
| 44 | |
| 45 | int main(int, char**) |
| 46 | { |
| 47 | static_assert((std::is_same<std::atomic<char>, std::atomic_char>::value), "" ); |
| 48 | static_assert((std::is_same<std::atomic<signed char>, std::atomic_schar>::value), "" ); |
| 49 | static_assert((std::is_same<std::atomic<unsigned char>, std::atomic_uchar>::value), "" ); |
| 50 | static_assert((std::is_same<std::atomic<short>, std::atomic_short>::value), "" ); |
| 51 | static_assert((std::is_same<std::atomic<unsigned short>, std::atomic_ushort>::value), "" ); |
| 52 | static_assert((std::is_same<std::atomic<int>, std::atomic_int>::value), "" ); |
| 53 | static_assert((std::is_same<std::atomic<unsigned int>, std::atomic_uint>::value), "" ); |
| 54 | static_assert((std::is_same<std::atomic<long>, std::atomic_long>::value), "" ); |
| 55 | static_assert((std::is_same<std::atomic<unsigned long>, std::atomic_ulong>::value), "" ); |
| 56 | static_assert((std::is_same<std::atomic<long long>, std::atomic_llong>::value), "" ); |
| 57 | static_assert((std::is_same<std::atomic<unsigned long long>, std::atomic_ullong>::value), "" ); |
| 58 | #ifndef TEST_HAS_NO_WIDE_CHARACTERS |
| 59 | static_assert((std::is_same<std::atomic<wchar_t>, std::atomic_wchar_t>::value), "" ); |
| 60 | #endif |
| 61 | #if TEST_STD_VER > 17 && defined(__cpp_char8_t) |
| 62 | static_assert((std::is_same<std::atomic<char8_t>, std::atomic_char8_t>::value), "" ); |
| 63 | #endif |
| 64 | static_assert((std::is_same<std::atomic<char16_t>, std::atomic_char16_t>::value), "" ); |
| 65 | static_assert((std::is_same<std::atomic<char32_t>, std::atomic_char32_t>::value), "" ); |
| 66 | |
| 67 | // Added by LWG 2441 |
| 68 | static_assert((std::is_same<std::atomic<std::intptr_t>, std::atomic_intptr_t>::value), "" ); |
| 69 | static_assert((std::is_same<std::atomic<std::uintptr_t>, std::atomic_uintptr_t>::value), "" ); |
| 70 | |
| 71 | static_assert((std::is_same<std::atomic<int8_t>, std::atomic_int8_t>::value), "" ); |
| 72 | static_assert((std::is_same<std::atomic<uint8_t>, std::atomic_uint8_t>::value), "" ); |
| 73 | static_assert((std::is_same<std::atomic<int16_t>, std::atomic_int16_t>::value), "" ); |
| 74 | static_assert((std::is_same<std::atomic<uint16_t>, std::atomic_uint16_t>::value), "" ); |
| 75 | static_assert((std::is_same<std::atomic<int32_t>, std::atomic_int32_t>::value), "" ); |
| 76 | static_assert((std::is_same<std::atomic<uint32_t>, std::atomic_uint32_t>::value), "" ); |
| 77 | static_assert((std::is_same<std::atomic<int64_t>, std::atomic_int64_t>::value), "" ); |
| 78 | static_assert((std::is_same<std::atomic<uint64_t>, std::atomic_uint64_t>::value), "" ); |
| 79 | |
| 80 | return 0; |
| 81 | } |
| 82 | |