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// ... assertion fails line 36 12 13// <atomic> 14 15// template <class T> 16// void 17// atomic_init(volatile atomic<T>* obj, T desr); 18// 19// template <class T> 20// void 21// atomic_init(atomic<T>* obj, T desr); 22 23#include <atomic> 24#include <type_traits> 25#include <cassert> 26 27#include "atomic_helpers.h" 28 29template <class T> 30struct TestFn { 31 void operator()() const { 32 typedef std::atomic<T> A; 33 A t; 34 std::atomic_init(&t, T(1)); 35 assert(t == T(1)); 36 volatile A vt; 37 std::atomic_init(&vt, T(2)); 38 assert(vt == T(2)); 39 } 40}; 41 42int main() 43{ 44 TestEachAtomicType<TestFn>()(); 45} 46