Debian Codegraph @

libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/max_size.cxx20.pass.cpp

raw
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 // <memory>
10
11 // allocator:
12 // size_type max_size() const throw();
13
14 // Removed in C++20, deprecated in C++17.
15
16 // REQUIRES: c++03 || c++11 || c++14 || c++17
17 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
18
19 #include <memory>
20 #include <limits>
21 #include <cstddef>
22 #include <cassert>
23
24 #include "test_macros.h"
25
26 int new_called = 0;
27
28 int main(int, char**) {
29 const std::allocator<int> a;
30 std::size_t M = a.max_size();
31 assert(M > 0xFFFF && M <= (std::numeric_limits<std::size_t>::max() / sizeof(int)));
32
33 return 0;
34 }