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 // <vector> 11 12 // void assign(initializer_list<value_type> il); 13 14 #include <vector> 15 #include <cassert> 16 17 #include "min_allocator.h" 18 #include "asan_testing.h" 19 main()20int main() 21 { 22 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 23 { 24 std::vector<int> d; 25 d.assign({3, 4, 5, 6}); 26 assert(d.size() == 4); 27 assert(is_contiguous_container_asan_correct(d)); 28 assert(d[0] == 3); 29 assert(d[1] == 4); 30 assert(d[2] == 5); 31 assert(d[3] == 6); 32 } 33 #if __cplusplus >= 201103L 34 { 35 std::vector<int, min_allocator<int>> d; 36 d.assign({3, 4, 5, 6}); 37 assert(d.size() == 4); 38 assert(is_contiguous_container_asan_correct(d)); 39 assert(d[0] == 3); 40 assert(d[1] == 4); 41 assert(d[2] == 5); 42 assert(d[3] == 6); 43 } 44 #endif 45 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 46 } 47