Home | History | Annotate | Download | only in util.smartptr.shared.atomic
      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 // UNSUPPORTED: libcpp-has-no-threads
     11 //
     12 // This test uses new symbols that were not defined in the libc++ shipped on
     13 // darwin11 and darwin12:
     14 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
     15 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
     16 
     17 // <memory>
     18 
     19 // shared_ptr
     20 
     21 // template <class T>
     22 // shared_ptr<T>
     23 // atomic_load_explicit(const shared_ptr<T>* p, memory_order mo)
     24 
     25 #include <memory>
     26 #include <cassert>
     27 
     28 int main()
     29 {
     30 #if __has_feature(cxx_atomic)
     31     {
     32         const std::shared_ptr<int> p(new int(3));
     33         std::shared_ptr<int> q = std::atomic_load_explicit(&p, std::memory_order_relaxed);
     34         assert(*q == *p);
     35     }
     36 #endif
     37 }
     38