exception_ptr.pass.cpp 915 B

12345678910111213141516171819202122232425262728293031323334353637
  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. // <exception>
  9. // typedef unspecified exception_ptr;
  10. // exception_ptr shall satisfy the requirements of NullablePointer.
  11. #include <exception>
  12. #include <cassert>
  13. #include "test_macros.h"
  14. int main(int, char**)
  15. {
  16. std::exception_ptr p;
  17. assert(p == nullptr);
  18. std::exception_ptr p2 = p;
  19. assert(nullptr == p);
  20. assert(!p);
  21. assert(p2 == p);
  22. p2 = p;
  23. assert(p2 == p);
  24. assert(p2 == nullptr);
  25. std::exception_ptr p3 = nullptr;
  26. assert(p3 == nullptr);
  27. p3 = nullptr;
  28. assert(p3 == nullptr);
  29. return 0;
  30. }