c33b515e780a6e5f29bd27f9deb2b57b43d214e9
[platform/upstream/llvm.git] /
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 // <unordered_map>
10
11 // Call erase(const_iterator first, const_iterator last); with second iterator from another container
12
13 // UNSUPPORTED: libcxx-no-debug-mode
14
15 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DEBUG=1
16
17 #include <unordered_map>
18
19 #include "test_macros.h"
20 #include "debug_macros.h"
21
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");
30
31     return 0;
32 }