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 // UNSUPPORTED: c++03, c++11, c++14
10 // TODO: Change to XFAIL once https://github.com/llvm/llvm-project/issues/40340 is fixed
11 // UNSUPPORTED: availability-pmr-missing
12 
13 // <memory_resource>
14 
15 // template <class T> class polymorphic_allocator
16 
17 // polymorphic_allocator<T>::polymorphic_allocator(polymorphic_allocator const &);
18 
19 #include <memory_resource>
20 #include <cassert>
21 #include <type_traits>
22 #include <utility>
23 
main(int,char **)24 int main(int, char**) {
25   typedef std::pmr::polymorphic_allocator<void> A1;
26   {
27     static_assert(std::is_copy_constructible<A1>::value, "");
28     static_assert(std::is_move_constructible<A1>::value, "");
29   }
30   // copy
31   {
32     A1 const a((std::pmr::memory_resource*)42);
33     A1 const a2(a);
34     assert(a.resource() == a2.resource());
35   }
36   // move
37   {
38     A1 a((std::pmr::memory_resource*)42);
39     A1 a2(std::move(a));
40     assert(a.resource() == a2.resource());
41     assert(a2.resource() == (std::pmr::memory_resource*)42);
42   }
43 
44   return 0;
45 }
46