1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <unordered_map>
11 
12 // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
13 //           class Alloc = allocator<pair<const Key, T>>>
14 // class unordered_map
15 
16 // http://llvm.org/bugs/show_bug.cgi?id=16538
17 // http://llvm.org/bugs/show_bug.cgi?id=16549
18 
19 #include <unordered_map>
20 
21 struct Key {
KeyKey22   template <typename T> Key(const T&) {}
operator ==Key23   bool operator== (const Key&) const { return true; }
24 };
25 
26 namespace std
27 {
28     template <>
29     struct hash<Key>
30     {
operator ()std::hash31         size_t operator()(Key const &) const {return 0;}
32     };
33 }
34 
35 int
main()36 main()
37 {
38     std::unordered_map<Key, int>::iterator it =
39         std::unordered_map<Key, int>().find(Key(0));
40     std::pair<std::unordered_map<Key, int>::iterator, bool> result =
41         std::unordered_map<Key, int>().insert(std::make_pair(Key(0), 0));
42 }
43