Fixed a possible overflow in a test of allocator::max_size().

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249349 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow 2015-10-05 20:50:25 +00:00
parent f956599e0e
commit ba4775171e

View File

@ -22,6 +22,6 @@ int new_called = 0;
int main()
{
const std::allocator<int> a;
std::size_t M = a.max_size() * sizeof(int);
assert(M > 0xFFFF && M <= std::numeric_limits<std::size_t>::max());
std::size_t M = a.max_size();
assert(M > 0xFFFF && M <= (std::numeric_limits<std::size_t>::max() / sizeof(int)));
}