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 // Can't test the system lib because this test enables debug mode
10 // UNSUPPORTED: with_system_cxx_lib=macosx
11 
12 // <list>
13 
14 // Call erase(const_iterator position) with end()
15 
16 #define _LIBCPP_DEBUG 1
17 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
18 
19 #include <list>
20 #include <cassert>
21 #include <cstdlib>
22 
23 #include "test_macros.h"
24 
main(int,char **)25 int main(int, char**)
26 {
27     int a1[] = {1, 2, 3};
28     std::list<int> l1(a1, a1+3);
29     std::list<int>::const_iterator i = l1.end();
30     l1.erase(i);
31     assert(false);
32 
33   return 0;
34 }
35