allocator_void.pass.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. // <memory>
  9. // template <>
  10. // class allocator<void>
  11. // {
  12. // public:
  13. // typedef void* pointer;
  14. // typedef const void* const_pointer;
  15. // typedef void value_type;
  16. //
  17. // template <class _Up> struct rebind {typedef allocator<_Up> other;};
  18. // };
  19. #include <memory>
  20. #include <type_traits>
  21. #include "test_macros.h"
  22. int main(int, char**)
  23. {
  24. static_assert((std::is_same<std::allocator<void>::pointer, void*>::value), "");
  25. static_assert((std::is_same<std::allocator<void>::const_pointer, const void*>::value), "");
  26. static_assert((std::is_same<std::allocator<void>::value_type, void>::value), "");
  27. static_assert((std::is_same<std::allocator<void>::rebind<int>::other,
  28. std::allocator<int> >::value), "");
  29. std::allocator<void> a;
  30. std::allocator<void> a2 = a;
  31. a2 = a;
  32. return 0;
  33. }