#include <memory>
#include <cassert>
+#include "test_macros.h"
+
template <typename T>
void test_max(size_t count)
{
}
}
-int main()
+template <typename T>
+void test()
{
- { // Bug 26812 -- allocating too large
- typedef double T;
- std::allocator<T> a;
- test_max<T> (a.max_size() + 1); // just barely too large
- test_max<T> (a.max_size() * 2); // significantly too large
- test_max<T> (((size_t) -1) / sizeof(T) + 1); // multiply will overflow
- test_max<T> ((size_t) -1); // way too large
- }
+ // Bug 26812 -- allocating too large
+ std::allocator<T> a;
+ test_max<T> (a.max_size() + 1); // just barely too large
+ test_max<T> (a.max_size() * 2); // significantly too large
+ test_max<T> (((size_t) -1) / sizeof(T) + 1); // multiply will overflow
+ test_max<T> ((size_t) -1); // way too large
+}
- {
- typedef const double T;
- std::allocator<T> a;
- test_max<T> (a.max_size() + 1); // just barely too large
- test_max<T> (a.max_size() * 2); // significantly too large
- test_max<T> (((size_t) -1) / sizeof(T) + 1); // multiply will overflow
- test_max<T> ((size_t) -1); // way too large
- }
+int main()
+{
+ test<double>();
+ LIBCPP_ONLY(test<const double>());
}
#include <type_traits>
#include <cstddef>
+#include "test_macros.h"
+
int main()
{
static_assert((std::is_same<std::allocator<char>::size_type, std::size_t>::value), "");
std::allocator<int> >::value), "");
static_assert((std::is_same<std::allocator< char>::is_always_equal, std::true_type>::value), "");
- static_assert((std::is_same<std::allocator<const char>::is_always_equal, std::true_type>::value), "");
+ LIBCPP_STATIC_ASSERT((std::is_same<std::allocator<const char>::is_always_equal, std::true_type>::value), "");
std::allocator<char> a;
std::allocator<char> a2 = a;