blob: 19d9646ad6162997509d03f63d8ed9d2fe62ec8d [file] [log] [blame]
Eric Fiselier257fd692016-05-07 01:04:55 +00001//===----------------------------------------------------------------------===//
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(memory_resource *)
17
18#include <experimental/memory_resource>
19#include <type_traits>
20#include <cassert>
21
22#include "test_memory_resource.hpp"
23
24namespace ex = std::experimental::pmr;
25
26int main()
27{
28 {
29 typedef ex::polymorphic_allocator<void> A;
30 static_assert(
31 std::is_convertible<decltype(nullptr), A>::value
32 , "Must be convertible"
33 );
34 static_assert(
35 std::is_convertible<ex::memory_resource *, A>::value
36 , "Must be convertible"
37 );
38 }
39 {
40 typedef ex::polymorphic_allocator<void> A;
41 TestResource R;
42 A const a(&R);
43 assert(a.resource() == &R);
44 }
45}