]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/utilities/memory/unique.ptr/unique.ptr.single/pointer_type.pass.cpp
Vendor import of libc++ 4.0.0 release r297347:
[FreeBSD/FreeBSD.git] / test / std / utilities / memory / unique.ptr / unique.ptr.single / pointer_type.pass.cpp
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 // <memory>
11
12 // unique_ptr
13
14 // Test unique_ptr::pointer type
15
16 #include <memory>
17 #include <type_traits>
18
19 #include "test_macros.h"
20
21 struct Deleter
22 {
23     struct pointer {};
24 };
25
26 struct D2 {
27 private:
28     typedef void pointer;
29 };
30
31 struct D3 {
32     static long pointer;
33 };
34
35 int main()
36 {
37     {
38     typedef std::unique_ptr<int> P;
39     static_assert((std::is_same<P::pointer, int*>::value), "");
40     }
41     {
42     typedef std::unique_ptr<int, Deleter> P;
43     static_assert((std::is_same<P::pointer, Deleter::pointer>::value), "");
44     }
45 #if TEST_STD_VER >= 11
46     {
47     typedef std::unique_ptr<int, D2> P;
48     static_assert(std::is_same<P::pointer, int*>::value, "");
49     }
50     {
51     typedef std::unique_ptr<int, D3> P;
52     static_assert(std::is_same<P::pointer, int*>::value, "");
53     }
54 #endif
55 }