atomic_store_explicit.pass.cpp revision 5fec82dc0db3623546038e4a86baa44f749e554f
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// <memory>
11
12// shared_ptr
13
14// template <class T>
15// void
16// atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo)
17
18#include <memory>
19#include <cassert>
20
21int main()
22{
23#if __has_feature(cxx_atomic)
24    {
25        std::shared_ptr<int> p;
26        std::shared_ptr<int> r(new int(3));
27        std::atomic_store_explicit(&p, r, std::memory_order_seq_cst);
28        assert(*p == *r);
29    }
30#endif
31}
32