1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // Call erase(const_iterator first, const_iterator last); with second iterator from another container
13 // UNSUPPORTED: libcxx-no-debug-mode
15 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
17 #include <unordered_map>
19 #include "test_macros.h"
20 #include "debug_macros.h"
22 int main(int, char**) {
23 typedef std::pair<int, int> P;
24 P a1[] = {P(1, 1), P(2, 2), P(3, 3)};
25 std::unordered_multimap<int, int> l1(a1, a1+3);
26 std::unordered_multimap<int, int> l2(a1, a1+3);
27 TEST_LIBCPP_ASSERT_FAILURE(
28 l1.erase(l1.cbegin(), std::next(l2.cbegin())),
29 "unordered container::erase(iterator, iterator) called with an iterator not referring to this container");