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// UNSUPPORTED: libcpp-has-no-threads 11 12// <atomic> 13 14// template <class T> 15// bool 16// atomic_is_lock_free(const volatile atomic<T>* obj); 17// 18// template <class T> 19// bool 20// atomic_is_lock_free(const atomic<T>* obj); 21 22#include <atomic> 23 24template <class T> 25void 26test() 27{ 28 typedef std::atomic<T> A; 29 A t; 30 bool b1 = std::atomic_is_lock_free(static_cast<const A*>(&t)); 31 volatile A vt; 32 bool b2 = std::atomic_is_lock_free(static_cast<const volatile A*>(&vt)); 33} 34 35struct A 36{ 37 char _[4]; 38}; 39 40int main() 41{ 42 test<A>(); 43 test<char>(); 44 test<signed char>(); 45 test<unsigned char>(); 46 test<short>(); 47 test<unsigned short>(); 48 test<int>(); 49 test<unsigned int>(); 50 test<long>(); 51 test<unsigned long>(); 52 test<long long>(); 53 test<unsigned long long>(); 54 test<wchar_t>(); 55#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS 56 test<char16_t>(); 57 test<char32_t>(); 58#endif // _LIBCPP_HAS_NO_UNICODE_CHARS 59 test<int*>(); 60 test<const int*>(); 61} 62