eq.pass.cpp 945 B

12345678910111213141516171819202122232425262728293031323334
  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. // <memory>
  9. // shared_ptr
  10. // template<class T, class U> bool operator==(const shared_ptr<T>& a, const shared_ptr<U>& b);
  11. // template<class T, class U> bool operator!=(const shared_ptr<T>& a, const shared_ptr<U>& b);
  12. #include <memory>
  13. #include <cassert>
  14. #include "test_macros.h"
  15. void do_nothing(int*) {}
  16. int main(int, char**)
  17. {
  18. int* ptr1(new int);
  19. int* ptr2(new int);
  20. const std::shared_ptr<int> p1(ptr1);
  21. const std::shared_ptr<int> p2(ptr2);
  22. const std::shared_ptr<int> p3(ptr2, do_nothing);
  23. assert(p1 != p2);
  24. assert(p2 == p3);
  25. return 0;
  26. }