1 | //===----------------------------------------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX26_REMOVED_SHARED_PTR_ATOMICS |
10 | // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS |
11 | // UNSUPPORTED: no-threads |
12 | |
13 | // <memory> |
14 | |
15 | // shared_ptr |
16 | |
17 | // template <class T> |
18 | // void |
19 | // atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo) // Deprecated in C++20, removed in C++26 |
20 | |
21 | // UNSUPPORTED: c++03 |
22 | |
23 | #include <memory> |
24 | |
25 | #include <atomic> |
26 | #include <cassert> |
27 | |
28 | #include "test_macros.h" |
29 | |
30 | int main(int, char**) |
31 | { |
32 | { |
33 | std::shared_ptr<int> p; |
34 | std::shared_ptr<int> r(new int(3)); |
35 | std::atomic_store_explicit(&p, r, std::memory_order_seq_cst); |
36 | assert(*p == *r); |
37 | } |
38 | |
39 | return 0; |
40 | } |
41 | |