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 // <vector>
11 
12 // Add to iterator out of bounds.
13 
14 #if _LIBCPP_DEBUG >= 1
15 
16 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
17 
18 #include <vector>
19 #include <cassert>
20 #include <iterator>
21 #include <exception>
22 #include <cstdlib>
23 
24 #include "min_allocator.h"
25 
main()26 int main()
27 {
28     {
29     typedef int T;
30     typedef std::vector<T> C;
31     C c(1);
32     C::iterator i = c.begin();
33     i += 1;
34     assert(i == c.end());
35     i = c.begin();
36     i += 2;
37     assert(false);
38     }
39 #if __cplusplus >= 201103L
40     {
41     typedef int T;
42     typedef std::vector<T, min_allocator<T>> C;
43     C c(1);
44     C::iterator i = c.begin();
45     i += 1;
46     assert(i == c.end());
47     i = c.begin();
48     i += 2;
49     assert(false);
50     }
51 #endif
52 }
53 
54 #else
55 
main()56 int main()
57 {
58 }
59 
60 #endif
61