eq.pass.cpp 856 B

1234567891011121314151617181920212223242526272829303132333435
  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. // <thread>
  11. // class thread::id
  12. // bool operator==(thread::id x, thread::id y);
  13. // bool operator!=(thread::id x, thread::id y);
  14. #include <thread>
  15. #include <cassert>
  16. #include "test_macros.h"
  17. int main(int, char**)
  18. {
  19. std::thread::id id0;
  20. std::thread::id id1;
  21. id1 = id0;
  22. assert( (id1 == id0));
  23. assert(!(id1 != id0));
  24. id1 = std::this_thread::get_id();
  25. assert(!(id1 == id0));
  26. assert( (id1 != id0));
  27. return 0;
  28. }