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