]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/libcxx/containers/sequences/list/list.cons/db_move.pass.cpp
Vendor import of libc++ trunk r302418:
[FreeBSD/FreeBSD.git] / test / libcxx / containers / sequences / list / list.cons / db_move.pass.cpp
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 // UNSUPPORTED: c++98, c++03
11
12 // Can't test the system lib because this test enables debug mode
13 // UNSUPPORTED: with_system_cxx_lib
14
15 // <list>
16
17 // list(list&& c);
18
19 #define _LIBCPP_DEBUG 1
20 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(1))
21
22 #include <list>
23 #include <cstdlib>
24 #include <cassert>
25 #include "MoveOnly.h"
26 #include "test_allocator.h"
27 #include "min_allocator.h"
28
29 int main()
30 {
31     std::list<int> l1 = {1, 2, 3};
32     std::list<int>::iterator i = l1.begin();
33     std::list<int> l2 = std::move(l1);
34     assert(*l2.erase(i) == 2);
35 }