1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <vector> 10 11 // Increment iterator past end. 12 13 // REQUIRES: has-unix-headers 14 // UNSUPPORTED: !libcpp-has-debug-mode, c++03 15 16 #include <vector> 17 #include <cassert> 18 19 #include "check_assertion.h" 20 #include "min_allocator.h" 21 main(int,char **)22int main(int, char**) { 23 { 24 typedef int T; 25 typedef std::vector<T> C; 26 C c(1); 27 C::iterator i = c.begin(); 28 ++i; 29 assert(i == c.end()); 30 TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable iterator"); 31 } 32 33 { 34 typedef int T; 35 typedef std::vector<T, min_allocator<T> > C; 36 C c(1); 37 C::iterator i = c.begin(); 38 ++i; 39 assert(i == c.end()); 40 TEST_LIBCPP_ASSERT_FAILURE(++i, "Attempted to increment a non-incrementable iterator"); 41 } 42 43 return 0; 44 } 45