Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / experimental / memory / memory.resource.aliases / header_set_synop.pass.cpp
blobdcb829063fb5b54fd73908dc264460afba1a2966
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 // UNSUPPORTED: c++03
11 // XFAIL: availability-aligned_allocation-missing
13 // <experimental/set>
15 // namespace std { namespace experimental { namespace pmr {
16 // template <class V, class Compare = less<V> >
17 // using set =
18 // ::std::set<V, Compare, polymorphic_allocator<V>>
20 // template <class V, class Compare = less<V> >
21 // using multiset =
22 // ::std::multiset<V, Compare, polymorphic_allocator<V>>
24 // }}} // namespace std::experimental::pmr
26 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
28 #include <experimental/set>
29 #include <experimental/memory_resource>
30 #include <type_traits>
31 #include <cassert>
33 #include "test_macros.h"
35 namespace pmr = std::experimental::pmr;
37 int main(int, char**)
39 using V = char;
40 using DC = std::less<V>;
41 using OC = std::greater<V>;
43 using StdSet = std::set<V, DC, pmr::polymorphic_allocator<V>>;
44 using PmrSet = pmr::set<V>;
45 static_assert(std::is_same<StdSet, PmrSet>::value, "");
48 using StdSet = std::set<V, OC, pmr::polymorphic_allocator<V>>;
49 using PmrSet = pmr::set<V, OC>;
50 static_assert(std::is_same<StdSet, PmrSet>::value, "");
53 pmr::set<int> m;
54 assert(m.get_allocator().resource() == pmr::get_default_resource());
57 using StdSet = std::multiset<V, DC, pmr::polymorphic_allocator<V>>;
58 using PmrSet = pmr::multiset<V>;
59 static_assert(std::is_same<StdSet, PmrSet>::value, "");
62 using StdSet = std::multiset<V, OC, pmr::polymorphic_allocator<V>>;
63 using PmrSet = pmr::multiset<V, OC>;
64 static_assert(std::is_same<StdSet, PmrSet>::value, "");
67 pmr::multiset<int> m;
68 assert(m.get_allocator().resource() == pmr::get_default_resource());
71 return 0;