db_local_iterators_8.pass.cpp revision 061d0cc4db18d17bf01ed14c5db0be098205bd47
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// Dereference non-dereferenceable iterator.
13
14#if _LIBCPP_DEBUG >= 1
15
16#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
17
18#include <unordered_map>
19#include <string>
20#include <cassert>
21#include <iterator>
22#include <exception>
23#include <cstdlib>
24
25#include "min_allocator.h"
26
27int main()
28{
29    {
30    typedef std::unordered_map<int, std::string> C;
31    C c(1);
32    C::local_iterator i = c.end(0);
33    C::value_type j = *i;
34    assert(false);
35    }
36#if __cplusplus >= 201103L
37    {
38    typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
39                        min_allocator<std::pair<const int, std::string>>> C;
40    C c(1);
41    C::local_iterator i = c.end(0);
42    C::value_type j = *i;
43    assert(false);
44    }
45#endif
46}
47
48#else
49
50int main()
51{
52}
53
54#endif
55