1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-exceptions
10 // XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11}}
12 // Prior to http://llvm.org/D123580, there was a bug with how the max_size()
13 // was calculated. That was inlined into some functions in the dylib, which leads
14 // to failures when running this test against an older system dylib.
15 // XFAIL: stdlib=apple-libc++ && target=arm64-apple-macosx{{11.0|12.0}}
19 // size_type max_size() const; // constexpr since C++20
25 #include "test_macros.h"
26 #include "min_allocator.h"
29 void test(const S
& s
) {
30 assert(s
.max_size() >= s
.size());
32 const std::size_t sz
= s2
.max_size() + 1;
35 } catch (const std::length_error
&) {
45 test(S("12345678901234567890123456789012345678901234567890"));
49 test_string
<std::string
>();
50 #if TEST_STD_VER >= 11
51 test_string
<std::basic_string
<char, std::char_traits
<char>, min_allocator
<char>>>();
57 int main(int, char**) {