1
//===----------------------------------------------------------------------===//
3
// The LLVM Compiler Infrastructure
5
// This file is dual licensed under the MIT and the University of Illinois Open
6
// Source Licenses. See LICENSE.TXT for details.
8
//===----------------------------------------------------------------------===//
12
// template <class Integral>
14
// atomic_fetch_or_explicit(volatile atomic<Integral>* obj, Integral op);
16
// template <class Integral>
18
// atomic_fetch_or_explicit(atomic<Integral>* obj, Integral op);
21
#include <type_traits>
29
typedef std::atomic<T> A;
31
std::atomic_init(&t, T(1));
32
assert(std::atomic_fetch_or_explicit(&t, T(2),
33
std::memory_order_seq_cst) == T(1));
37
typedef std::atomic<T> A;
39
std::atomic_init(&t, T(3));
40
assert(std::atomic_fetch_or_explicit(&t, T(2),
41
std::memory_order_seq_cst) == T(3));
50
test<unsigned char>();
52
test<unsigned short>();
56
test<unsigned long>();
58
test<unsigned long long>();
60
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
63
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS