//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Test nested types // template // class atomic // { // public: // typedef T value_type; // }; #include #include #include #include #include #include "test_macros.h" #ifndef TEST_HAS_NO_THREADS # include #endif template struct test_atomic { test_atomic() { A a; (void)a; #if TEST_STD_VER >= 17 static_assert((std::is_same_v), ""); #endif } }; template struct test_atomic { test_atomic() { A a; (void)a; #if TEST_STD_VER >= 17 static_assert((std::is_same_v), ""); static_assert((std::is_same_v), ""); #endif } }; template struct test_atomic { test_atomic() { A a; (void)a; #if TEST_STD_VER >= 17 static_assert((std::is_same_v), ""); static_assert((std::is_same_v), ""); #endif } }; template void test() { using A = std::atomic; #if TEST_STD_VER >= 17 static_assert((std::is_same_v), ""); #endif test_atomic::value && !std::is_same::value>(); } struct TriviallyCopyable { int i_; }; struct WeirdTriviallyCopyable { char i, j, k; /* the 3 chars of doom */ }; struct PaddedTriviallyCopyable { char i; int j; /* probably lock-free? */ }; struct LargeTriviallyCopyable { int i, j[127]; /* decidedly not lock-free */ }; int main(int, char**) { test (); test (); test (); test (); test (); test (); test (); test (); test (); test (); test (); test (); #if TEST_STD_VER > 17 && defined(__cpp_char8_t) test (); #endif test (); test (); #ifndef TEST_HAS_NO_WIDE_CHARACTERS test (); #endif test (); test (); test (); test (); test (); test (); test (); test (); test (); test (); test (); test (); test (); test (); test (); test (); test< std::int8_t> (); test (); test< std::int16_t> (); test (); test< std::int32_t> (); test (); test< std::int64_t> (); test (); test (); test (); test (); test (); test (); test (); test (); test (); test(); test(); #ifndef __APPLE__ // Apple doesn't ship libatomic /* These aren't going to be lock-free, so some libatomic.a is necessary. */ test(); test(); #endif #ifndef TEST_HAS_NO_THREADS test(); #endif test(); test(); #if TEST_STD_VER >= 20 test(); static_assert(std::is_signed_v); static_assert(std::is_integral_v); test(); static_assert(std::is_unsigned_v); static_assert(std::is_integral_v); /* test>(); */ #endif return 0; }