]>
Commit | Line | Data |
---|---|---|
be8de894 JW |
1 | // Copyright (C) 2014 Free Software Foundation, Inc. |
2 | // | |
3 | // This file is part of the GNU ISO C++ Library. This library is free | |
4 | // software; you can redistribute it and/or modify it under the | |
5 | // terms of the GNU General Public License as published by the | |
6 | // Free Software Foundation; either version 3, or (at your option) | |
7 | // any later version. | |
8 | ||
9 | // This library is distributed in the hope that it will be useful, | |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | // GNU General Public License for more details. | |
13 | ||
14 | // You should have received a copy of the GNU General Public License along | |
15 | // with this library; see the file COPYING3. If not see | |
16 | // <http://www.gnu.org/licenses/>. | |
17 | ||
18 | // { dg-options "-std=gnu++11" } | |
19 | // { dg-require-gthreads "" } | |
20 | ||
21 | #include <memory> | |
22 | ||
23 | int main() | |
24 | { | |
25 | using test_type = std::shared_ptr<int>; | |
26 | bool test __attribute__ ((unused)) = false; | |
27 | constexpr auto mo = std::memory_order_seq_cst; | |
28 | const test_type p; | |
29 | test = std::atomic_is_lock_free(&p); | |
30 | test_type p2 = std::atomic_load(&p); | |
31 | test_type p3 = std::atomic_load_explicit(&p, mo); | |
32 | std::atomic_store(&p2, p); | |
33 | std::atomic_store_explicit(&p2, p, mo); | |
34 | test_type p4 = std::atomic_exchange(&p2, p); | |
35 | p4 = std::atomic_exchange_explicit(&p2, p, mo); | |
36 | test = std::atomic_compare_exchange_weak(&p2, &p3, p); | |
37 | test = std::atomic_compare_exchange_strong(&p2, &p3, p); | |
38 | test = std::atomic_compare_exchange_weak_explicit(&p2, &p3, p, mo, mo); | |
39 | test = std::atomic_compare_exchange_strong_explicit(&p2, &p3, p, mo, mo); | |
40 | } |