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 // <list> 10 11 // Call erase(const_iterator position) with iterator from another container 12 13 // REQUIRES: has-unix-headers 14 // UNSUPPORTED: !libcpp-has-legacy-debug-mode, c++03 15 16 #include <list> 17 18 #include "check_assertion.h" 19 main(int,char **)20int main(int, char**) { 21 int a1[] = {1, 2, 3}; 22 std::list<int> l1(a1, a1+3); 23 std::list<int> l2(a1, a1+3); 24 std::list<int>::const_iterator i = l2.begin(); 25 TEST_LIBCPP_ASSERT_FAILURE(l1.erase(i), "list::erase(iterator) called with an iterator not referring to this list"); 26 27 return 0; 28 } 29