diff options
Diffstat (limited to 'test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp')
-rw-r--r-- | test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp b/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp new file mode 100644 index 000000000000..3307017989eb --- /dev/null +++ b/test/std/containers/sequences/list/list.cons/initializer_list.pass.cpp @@ -0,0 +1,43 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <list> + +// list(initializer_list<value_type> il); + +#include <list> +#include <cassert> + +#include "min_allocator.h" + +int main() +{ +#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS + { + std::list<int> d = {3, 4, 5, 6}; + assert(d.size() == 4); + std::list<int>::iterator i = d.begin(); + assert(*i++ == 3); + assert(*i++ == 4); + assert(*i++ == 5); + assert(*i++ == 6); + } +#if __cplusplus >= 201103L + { + std::list<int, min_allocator<int>> d = {3, 4, 5, 6}; + assert(d.size() == 4); + std::list<int, min_allocator<int>>::iterator i = d.begin(); + assert(*i++ == 3); + assert(*i++ == 4); + assert(*i++ == 5); + assert(*i++ == 6); + } +#endif +#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS +} |