max_size.pass.cpp revision b64f8b07c104c6cc986570ac8ee0ed16a9f23976
1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <memory>
11
12// allocator:
13// size_type max_size() const throw();
14
15#include <memory>
16#include <limits>
17#include <cstddef>
18#include <cassert>
19
20int new_called = 0;
21
22int main()
23{
24    const std::allocator<int> a;
25    std::size_t M = a.max_size() * sizeof(int);
26    assert(M > 0xFFFF && M <= std::numeric_limits<std::size_t>::max());
27}
28