Eric Fiselier | 774c7c5 | 2016-02-10 20:46:23 +0000 | [diff] [blame] | 1 | |
| 2 | //===----------------------------------------------------------------------===// |
| 3 | // |
| 4 | // The LLVM Compiler Infrastructure |
| 5 | // |
| 6 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 7 | // Source Licenses. See LICENSE.TXT for details. |
| 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | // <unordered_map> |
| 12 | |
| 13 | // Check that std::unordered_map and it's iterators can be instantiated with an incomplete |
| 14 | // type. |
| 15 | |
| 16 | #include <unordered_map> |
| 17 | |
| 18 | template <class Tp> |
| 19 | struct MyHash { |
| 20 | MyHash() {} |
| 21 | std::size_t operator()(Tp const&) const {return 42;} |
| 22 | }; |
| 23 | |
| 24 | struct A { |
| 25 | typedef std::unordered_map<A, A, MyHash<A> > Map; |
| 26 | Map m; |
| 27 | Map::iterator it; |
| 28 | Map::const_iterator cit; |
| 29 | Map::local_iterator lit; |
| 30 | Map::const_local_iterator clit; |
| 31 | }; |
| 32 | |
| 33 | inline bool operator==(A const& L, A const& R) { return &L == &R; } |
| 34 | |
| 35 | int main() { |
| 36 | A a; |
| 37 | } |