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 // <list>
11
12 // void pop_back();
13
14 #if _LIBCPP_DEBUG >= 1
15 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
16 #endif
17
18 #include <list>
19 #include <cassert>
20
21 #include "min_allocator.h"
22
main()23 int main()
24 {
25 {
26 int a[] = {1, 2, 3};
27 std::list<int> c(a, a+3);
28 c.pop_back();
29 assert(c == std::list<int>(a, a+2));
30 c.pop_back();
31 assert(c == std::list<int>(a, a+1));
32 c.pop_back();
33 assert(c.empty());
34 #if _LIBCPP_DEBUG >= 1
35 c.pop_back();
36 assert(false);
37 #endif
38 }
39 #if __cplusplus >= 201103L
40 {
41 int a[] = {1, 2, 3};
42 std::list<int, min_allocator<int>> c(a, a+3);
43 c.pop_back();
44 assert((c == std::list<int, min_allocator<int>>(a, a+2)));
45 c.pop_back();
46 assert((c == std::list<int, min_allocator<int>>(a, a+1)));
47 c.pop_back();
48 assert(c.empty());
49 #if _LIBCPP_DEBUG >= 1
50 c.pop_back();
51 assert(false);
52 #endif
53 }
54 #endif
55 }
56