1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <atomic>
11 
12 // template <class T>
13 //     bool
14 //     atomic_is_lock_free(const volatile atomic<T>* obj);
15 //
16 // template <class T>
17 //     bool
18 //     atomic_is_lock_free(const atomic<T>* obj);
19 
20 #include <atomic>
21 
22 template <class T>
23 void
test()24 test()
25 {
26     typedef std::atomic<T> A;
27     A t;
28     bool b1 = std::atomic_is_lock_free(static_cast<const A*>(&t));
29     volatile A vt;
30     bool b2 = std::atomic_is_lock_free(static_cast<const volatile A*>(&vt));
31 }
32 
33 struct A
34 {
35     char _[4];
36 };
37 
main()38 int main()
39 {
40     test<A>();
41     test<char>();
42     test<signed char>();
43     test<unsigned char>();
44     test<short>();
45     test<unsigned short>();
46     test<int>();
47     test<unsigned int>();
48     test<long>();
49     test<unsigned long>();
50     test<long long>();
51     test<unsigned long long>();
52     test<wchar_t>();
53 #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
54     test<char16_t>();
55     test<char32_t>();
56 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
57     test<int*>();
58     test<const int*>();
59 }
60