lt.pass.cpp 883 B

123456789101112131415161718192021222324252627282930313233
  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. #include <memory>
  12. #include <cassert>
  13. #include "test_macros.h"
  14. void do_nothing(int*) {}
  15. int main(int, char**)
  16. {
  17. int* ptr1(new int);
  18. int* ptr2(new int);
  19. const std::shared_ptr<int> p1(ptr1);
  20. const std::shared_ptr<int> p2(ptr2);
  21. const std::shared_ptr<int> p3(ptr2, do_nothing);
  22. assert((p1 < p2) == (ptr1 < ptr2));
  23. assert(!(p2 < p3) && !(p3 < p2));
  24. return 0;
  25. }