bad_weak_ptr.pass.cpp 834 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. // class bad_weak_ptr
  10. // : public std::exception
  11. // {
  12. // public:
  13. // bad_weak_ptr();
  14. // };
  15. #include <memory>
  16. #include <type_traits>
  17. #include <cassert>
  18. #include <cstring>
  19. #include "test_macros.h"
  20. int main(int, char**)
  21. {
  22. static_assert((std::is_base_of<std::exception, std::bad_weak_ptr>::value), "");
  23. std::bad_weak_ptr e;
  24. std::bad_weak_ptr e2 = e;
  25. e2 = e;
  26. assert(std::strcmp(e.what(), "bad_weak_ptr") == 0);
  27. return 0;
  28. }