From e57a2a31447e009cfe8c503429078e740a8a8448 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 18 Nov 2016 21:54:31 +0000 Subject: [PATCH] [libcxx] [test] D26813: allocator is non-Standard. N4582 17.6.3.5 [allocator.requirements] says that allocators are given cv-unqualified object types, and N4582 20.9.9 [default.allocator] implies that allocator is ill-formed (due to colliding address() overloads). Therefore, tests for allocator should be marked as libcxx-specific (if not removed outright). llvm-svn: 287381 --- .../allocator.members/allocate.size.pass.cpp | 32 ++++++++++------------ .../default.allocator/allocator_types.pass.cpp | 4 ++- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp index 4f0c439..768d418 100644 --- a/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp +++ b/libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp @@ -16,6 +16,8 @@ #include #include +#include "test_macros.h" + template void test_max(size_t count) { @@ -27,23 +29,19 @@ void test_max(size_t count) } } -int main() +template +void test() { - { // Bug 26812 -- allocating too large - typedef double T; - std::allocator a; - test_max (a.max_size() + 1); // just barely too large - test_max (a.max_size() * 2); // significantly too large - test_max (((size_t) -1) / sizeof(T) + 1); // multiply will overflow - test_max ((size_t) -1); // way too large - } + // Bug 26812 -- allocating too large + std::allocator a; + test_max (a.max_size() + 1); // just barely too large + test_max (a.max_size() * 2); // significantly too large + test_max (((size_t) -1) / sizeof(T) + 1); // multiply will overflow + test_max ((size_t) -1); // way too large +} - { - typedef const double T; - std::allocator a; - test_max (a.max_size() + 1); // just barely too large - test_max (a.max_size() * 2); // significantly too large - test_max (((size_t) -1) / sizeof(T) + 1); // multiply will overflow - test_max ((size_t) -1); // way too large - } +int main() +{ + test(); + LIBCPP_ONLY(test()); } diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp index cba3210..7f25e57 100644 --- a/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp +++ b/libcxx/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp @@ -32,6 +32,8 @@ #include #include +#include "test_macros.h" + int main() { static_assert((std::is_same::size_type, std::size_t>::value), ""); @@ -45,7 +47,7 @@ int main() std::allocator >::value), ""); static_assert((std::is_same::is_always_equal, std::true_type>::value), ""); - static_assert((std::is_same::is_always_equal, std::true_type>::value), ""); + LIBCPP_STATIC_ASSERT((std::is_same::is_always_equal, std::true_type>::value), ""); std::allocator a; std::allocator a2 = a; -- 2.7.4