15a83710eSEric Fiselier //===----------------------------------------------------------------------===// 25a83710eSEric Fiselier // 357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 65a83710eSEric Fiselier // 75a83710eSEric Fiselier //===----------------------------------------------------------------------===// 85a83710eSEric Fiselier // 9a7f9895cSLouis Dionne // UNSUPPORTED: no-threads 105a83710eSEric Fiselier 11f9127593SEric Fiselier // <thread> 125a83710eSEric Fiselier 135a83710eSEric Fiselier // template <class T> 145a83710eSEric Fiselier // struct hash 155a83710eSEric Fiselier // { 165a83710eSEric Fiselier // size_t operator()(T val) const; 175a83710eSEric Fiselier // }; 185a83710eSEric Fiselier 195a83710eSEric Fiselier // Not very portable 205a83710eSEric Fiselier 215a83710eSEric Fiselier #include <thread> 225a83710eSEric Fiselier #include <cassert> 235a83710eSEric Fiselier 247c803385SMarshall Clow #include "test_macros.h" 257c803385SMarshall Clow main(int,char **)262df59c50SJF Bastienint main(int, char**) 275a83710eSEric Fiselier { 285a83710eSEric Fiselier std::thread::id id1; 295a83710eSEric Fiselier std::thread::id id2 = std::this_thread::get_id(); 305a83710eSEric Fiselier typedef std::hash<std::thread::id> H; 31*681cde7dSNikolas Klauser #if TEST_STD_VER <= 14 32d95510ebSMarshall Clow static_assert((std::is_same<typename H::argument_type, std::thread::id>::value), "" ); 33d95510ebSMarshall Clow static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" ); 34*681cde7dSNikolas Klauser #endif 357c803385SMarshall Clow ASSERT_NOEXCEPT(H()(id2)); 365a83710eSEric Fiselier H h; 375a83710eSEric Fiselier assert(h(id1) != h(id2)); 382df59c50SJF Bastien 392df59c50SJF Bastien return 0; 405a83710eSEric Fiselier } 41