atomic_load.pass.cpp 962 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. // UNSUPPORTED: libcpp-has-no-threads
  10. //
  11. // This test uses new symbols that were not defined in the libc++ shipped on
  12. // darwin11 and darwin12:
  13. // XFAIL: availability=macosx10.7
  14. // XFAIL: availability=macosx10.8
  15. // <memory>
  16. // shared_ptr
  17. // template <class T>
  18. // shared_ptr<T>
  19. // atomic_load(const shared_ptr<T>* p)
  20. // UNSUPPORTED: c++98, c++03
  21. #include <memory>
  22. #include <cassert>
  23. #include "test_macros.h"
  24. int main(int, char**)
  25. {
  26. {
  27. std::shared_ptr<int> p(new int(3));
  28. std::shared_ptr<int> q = std::atomic_load(&p);
  29. assert(*q == *p);
  30. }
  31. return 0;
  32. }