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 clear() noexcept; 13 14 #include <vector> 15 #include <cassert> 16 17 #include "test_macros.h" 18 #include "min_allocator.h" 19 #include "asan_testing.h" 20 main()21int main() 22 { 23 { 24 int a[] = {1, 2, 3}; 25 std::vector<int> c(a, a+3); 26 ASSERT_NOEXCEPT(c.clear()); 27 c.clear(); 28 assert(c.empty()); 29 LIBCPP_ASSERT(c.__invariants()); 30 LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); 31 } 32 #if TEST_STD_VER >= 11 33 { 34 int a[] = {1, 2, 3}; 35 std::vector<int, min_allocator<int>> c(a, a+3); 36 ASSERT_NOEXCEPT(c.clear()); 37 c.clear(); 38 assert(c.empty()); 39 LIBCPP_ASSERT(c.__invariants()); 40 LIBCPP_ASSERT(is_contiguous_container_asan_correct(c)); 41 } 42 #endif 43 } 44