Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / thread / thread.threads / thread.thread.class / thread.thread.id / thread_id.pass.cpp
blob7cc0911082f7082800eff46fd4970925bc8e8c4e
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: no-threads
11 // <thread>
13 // template <class T>
14 // struct hash
15 // {
16 // size_t operator()(T val) const;
17 // };
19 // Not very portable
21 #include <cassert>
22 #include <functional>
23 #include <thread>
25 #include "test_macros.h"
27 int main(int, char**)
29 std::thread::id id1;
30 std::thread::id id2 = std::this_thread::get_id();
31 typedef std::hash<std::thread::id> H;
32 #if TEST_STD_VER <= 14
33 static_assert((std::is_same<typename H::argument_type, std::thread::id>::value), "" );
34 static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
35 #endif
36 ASSERT_NOEXCEPT(H()(id2));
37 H h;
38 assert(h(id1) != h(id2));
40 return 0;