From b631c24359c8299d570786abc6fe81920d97c67b Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Sun, 25 Oct 2015 19:34:04 +0000 Subject: [PATCH] Add a test for LWG#2466: allocator_traits::max_size() default behavior is incorrect llvm-svn: 251252 --- libcxx/include/memory | 2 +- .../allocator.traits.members/max_size.pass.cpp | 4 ++-- libcxx/www/cxx1z_status.html | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/libcxx/include/memory b/libcxx/include/memory index 97ad440367b2..04d57d5d7f0d 100644 --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -1678,7 +1678,7 @@ private: {return __a.max_size();} _LIBCPP_INLINE_VISIBILITY static size_type __max_size(false_type, const allocator_type&) - {return numeric_limits::max();} + {return numeric_limits::max() / sizeof(value_type);} _LIBCPP_INLINE_VISIBILITY static allocator_type diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp index 1fa7291203ed..352c7c8d0caf 100644 --- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp +++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp @@ -45,12 +45,12 @@ int main() { A a; assert(std::allocator_traits >::max_size(a) == - std::numeric_limits::max()); + std::numeric_limits::max() / sizeof(int)); } { const A a = {}; assert(std::allocator_traits >::max_size(a) == - std::numeric_limits::max()); + std::numeric_limits::max() / sizeof(int)); } #endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE { diff --git a/libcxx/www/cxx1z_status.html b/libcxx/www/cxx1z_status.html index 1df7401e28b3..5f582f1c70ed 100644 --- a/libcxx/www/cxx1z_status.html +++ b/libcxx/www/cxx1z_status.html @@ -172,7 +172,7 @@ 2435reference_wrapper::operator()'s Remark should be deletedKonaComplete 2447Allocators and volatile-qualified value typesKonaComplete 2462std::ios_base::failure is overspecifiedKonaComplete - 2466allocator_traits::max_size() default behavior is incorrectKonaPatch Ready + 2466allocator_traits::max_size() default behavior is incorrectKonaComplete 2469Wrong specification of Requires clause of operator[] for map and unordered_mapKona 2473basic_filebuf's relation to C FILE semanticsKonaComplete 2476scoped_allocator_adaptor is not assignableKonaPatch Ready @@ -184,7 +184,6 @@ 2487bind() should be const-overloaded, not cv-overloadedKonaComplete 2489mem_fn() should be noexceptKonaPatch Ready 2492Clarify requirements for compKonaComplete - 2494[fund.ts.v2] ostream_joiner needs noexceptKona 2495There is no such thing as an Exception Safety elementKona