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// UNSUPPORTED: c++03
10
11// <list>
12
13// list(initializer_list<value_type> il);
14
15#include <list>
16#include <cassert>
17
18#include "test_macros.h"
19#include "min_allocator.h"
20
21int main(int, char**) {
22 {
23 std::list<int> d = {3, 4, 5, 6};
24 assert(d.size() == 4);
25 std::list<int>::iterator i = d.begin();
26 assert(*i++ == 3);
27 assert(*i++ == 4);
28 assert(*i++ == 5);
29 assert(*i++ == 6);
30 }
31 {
32 std::list<int, min_allocator<int>> d = {3, 4, 5, 6};
33 assert(d.size() == 4);
34 std::list<int, min_allocator<int>>::iterator i = d.begin();
35 assert(*i++ == 3);
36 assert(*i++ == 4);
37 assert(*i++ == 5);
38 assert(*i++ == 6);
39 }
40
41 return 0;
42}
43

source code of libcxx/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp