1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// UNSUPPORTED: c++98, c++03
11
12// <experimental/memory_resource>
13
14// template <class T> class polymorphic_allocator
15
16// polymorphic_allocator<T>::polymorphic_allocator(polymorphic_allocator const &);
17
18#include <experimental/memory_resource>
19#include <type_traits>
20#include <cassert>
21
22namespace ex = std::experimental::pmr;
23
24int main()
25{
26    typedef ex::polymorphic_allocator<void> A1;
27    {
28        static_assert(
29            std::is_copy_constructible<A1>::value, ""
30          );
31        static_assert(
32            std::is_move_constructible<A1>::value, ""
33          );
34    }
35    // copy
36    {
37        A1 const a((ex::memory_resource*)42);
38        A1 const a2(a);
39        assert(a.resource() == a2.resource());
40    }
41    // move
42    {
43        A1 a((ex::memory_resource*)42);
44        A1 a2(std::move(a));
45        assert(a.resource() == a2.resource());
46        assert(a2.resource() == (ex::memory_resource*)42);
47    }
48}
49