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 // <typeindex>
10 
11 // struct hash<type_index>
12 // {
13 //     size_t operator()(type_index index) const;
14 // };
15 
16 // UNSUPPORTED: no-rtti
17 
18 #include <typeindex>
19 #include <type_traits>
20 
21 #include "test_macros.h"
22 #if TEST_STD_VER >= 11
23 #include "poisoned_hash_helper.h"
24 #endif
25 
main(int,char **)26 int main(int, char**)
27 {
28   {
29 #if TEST_STD_VER <= 14
30     typedef std::hash<std::type_index> H;
31     static_assert((std::is_same<typename H::argument_type, std::type_index>::value), "" );
32     static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
33 #endif
34   }
35 #if TEST_STD_VER >= 11
36   {
37     test_hash_enabled_for_type<std::type_index>(std::type_index(typeid(int)));
38   }
39 #endif
40 
41   return 0;
42 }
43