db_iterators_8.pass.cpp (1244B)
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 "test_macros.h" 26 #include "min_allocator.h" 27 28 int main() 29 { 30 { 31 typedef std::unordered_map<int, std::string> C; 32 C c; 33 c.insert(std::make_pair(1, "one")); 34 C::iterator i = c.end(); 35 C::value_type j = *i; 36 assert(false); 37 } 38 #if TEST_STD_VER >= 11 39 { 40 typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>, 41 min_allocator<std::pair<const int, std::string>>> C; 42 C c; 43 c.insert(std::make_pair(1, "one")); 44 C::iterator i = c.end(); 45 C::value_type j = *i; 46 assert(false); 47 } 48 #endif 49 } 50 51 #else 52 53 int main() 54 { 55 } 56 57 #endif