summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/memory/default.allocator/allocator_types.void.compile.pass.cpp
blob: d7b4a1b1bdf4da64d7f8680820371642e517c722 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// Check that the nested types of std::allocator<void> are provided.
// After C++17, those are not provided in the primary template and the
// explicit specialization doesn't exist anymore, so this test is moot.

// REQUIRES: c++03 || c++11 || c++14 || c++17

// template <>
// class allocator<void>
// {
// public:
//     typedef void*                                 pointer;
//     typedef const void*                           const_pointer;
//     typedef void                                  value_type;
//
//     template <class _Up> struct rebind {typedef allocator<_Up> other;};
// };

// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS

#include <memory>
#include <type_traits>

static_assert((std::is_same<std::allocator<void>::pointer, void*>::value), "");
static_assert((std::is_same<std::allocator<void>::const_pointer, const void*>::value), "");
static_assert((std::is_same<std::allocator<void>::value_type, void>::value), "");
static_assert((std::is_same<std::allocator<void>::rebind<int>::other,
                            std::allocator<int> >::value), "");