diff options
Diffstat (limited to 'libcxx/test/std/utilities/memory/default.allocator/allocator_types.void.compile.pass.cpp')
-rw-r--r-- | libcxx/test/std/utilities/memory/default.allocator/allocator_types.void.compile.pass.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.void.compile.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.void.compile.pass.cpp new file mode 100644 index 000000000000..d7b4a1b1bdf4 --- /dev/null +++ b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.void.compile.pass.cpp @@ -0,0 +1,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), ""); |