max_size.pass.cpp revision c52f43e72dfcea03037729649da84c23b3beb04a
1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. 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