• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // This test uses new symbols that were not defined in the libc++ shipped on
11 // darwin11 and darwin12:
12 // XFAIL: with_system_lib=x86_64-apple-darwin11
13 // XFAIL: with_system_lib=x86_64-apple-darwin12
14 
15 // <memory>
16 
17 // shared_ptr
18 
19 // template <class T>
20 // shared_ptr<T>
21 // atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r)
22 
23 #include <memory>
24 #include <cassert>
25 
main()26 int main()
27 {
28 #if __has_feature(cxx_atomic)
29     {
30         std::shared_ptr<int> p(new int(4));
31         std::shared_ptr<int> r(new int(3));
32         r = std::atomic_exchange(&p, r);
33         assert(*p == 3);
34         assert(*r == 4);
35     }
36 #endif
37 }
38