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
21struct Deleter
22{
23    struct pointer {};
24};
25
26struct D2 {
27private:
28    typedef void pointer;
29};
30
31struct D3 {
32    static long pointer;
33};
34
35int 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}
56