Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / containers / associative / multimap / multimap.cons / default_noexcept.pass.cpp
blob6abc125707629505c55c8de22a633ae49222376c
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 //===----------------------------------------------------------------------===//
9 // <map>
11 // multimap()
12 // noexcept(
13 // is_nothrow_default_constructible<allocator_type>::value &&
14 // is_nothrow_default_constructible<key_compare>::value &&
15 // is_nothrow_copy_constructible<key_compare>::value);
17 // This tests a conforming extension
19 // UNSUPPORTED: c++03
21 #include <map>
22 #include <cassert>
24 #include "test_macros.h"
25 #include "MoveOnly.h"
26 #include "test_allocator.h"
28 template <class T>
29 struct some_comp
31 typedef T value_type;
32 some_comp();
33 bool operator()(const T&, const T&) const { return false; }
36 int main(int, char**)
38 typedef std::pair<const MoveOnly, MoveOnly> V;
39 #if defined(_LIBCPP_VERSION)
41 typedef std::multimap<MoveOnly, MoveOnly> C;
42 static_assert(std::is_nothrow_default_constructible<C>::value, "");
45 typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, test_allocator<V>> C;
46 static_assert(std::is_nothrow_default_constructible<C>::value, "");
48 #endif // _LIBCPP_VERSION
50 typedef std::multimap<MoveOnly, MoveOnly, std::less<MoveOnly>, other_allocator<V>> C;
51 static_assert(!std::is_nothrow_default_constructible<C>::value, "");
54 typedef std::multimap<MoveOnly, MoveOnly, some_comp<MoveOnly>> C;
55 static_assert(!std::is_nothrow_default_constructible<C>::value, "");
58 return 0;