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// ~unordered_multimap() // implied noexcept;
12
13// UNSUPPORTED: c++03
14
15#include <unordered_map>
16#include <cassert>
17
18#include "test_macros.h"
19#include "MoveOnly.h"
20#include "test_allocator.h"
21
22template <class T>
23struct some_comp {
24 typedef T value_type;
25 ~some_comp() noexcept(false);
26 bool operator()(const T&, const T&) const { return false; }
27};
28
29template <class T>
30struct some_hash {
31 typedef T value_type;
32 some_hash();
33 some_hash(const some_hash&);
34 ~some_hash() noexcept(false);
35 std::size_t operator()(T const&) const;
36};
37
38int main(int, char**) {
39 {
40 typedef std::unordered_multimap<MoveOnly, MoveOnly> C;
41 static_assert(std::is_nothrow_destructible<C>::value, "");
42 }
43 {
44 typedef std::unordered_multimap<MoveOnly,
45 MoveOnly,
46 std::hash<MoveOnly>,
47 std::equal_to<MoveOnly>,
48 test_allocator<std::pair<const MoveOnly, MoveOnly>>>
49 C;
50 static_assert(std::is_nothrow_destructible<C>::value, "");
51 }
52 {
53 typedef std::unordered_multimap<MoveOnly,
54 MoveOnly,
55 std::hash<MoveOnly>,
56 std::equal_to<MoveOnly>,
57 other_allocator<std::pair<const MoveOnly, MoveOnly>>>
58 C;
59 static_assert(std::is_nothrow_destructible<C>::value, "");
60 }
61#if defined(_LIBCPP_VERSION)
62 {
63 typedef std::unordered_multimap<MoveOnly, MoveOnly, some_hash<MoveOnly>> C;
64 static_assert(!std::is_nothrow_destructible<C>::value, "");
65 }
66 {
67 typedef std::unordered_multimap<MoveOnly, MoveOnly, std::hash<MoveOnly>, some_comp<MoveOnly>> C;
68 static_assert(!std::is_nothrow_destructible<C>::value, "");
69 }
70#endif // _LIBCPP_VERSION
71
72 return 0;
73}
74

source code of libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/dtor_noexcept.pass.cpp