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 // struct atomic_flag 15 16 // atomic_flag() = default; 17 18 #include <atomic> 19 #include <new> 20 #include <cassert> 21 main()22int main() 23 { 24 std::atomic_flag f; 25 26 { 27 typedef std::atomic_flag A; 28 _ALIGNAS_TYPE(A) char storage[sizeof(A)] = {1}; 29 A& zero = *new (storage) A(); 30 assert(!zero.test_and_set()); 31 zero.~A(); 32 } 33 } 34