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 // XFAIL: LIBCXX-AIX-FIXME
10 
11 // <string>
12 
13 // const_iterator cend() const; // constexpr since C++20
14 
15 #include <string>
16 #include <cassert>
17 
18 #include "test_macros.h"
19 #include "min_allocator.h"
20 
21 template <class S>
22 TEST_CONSTEXPR_CXX20 void
23 test(const S& s)
24 {
25     typename S::const_iterator ce = s.cend();
26     assert(ce == s.end());
27 }
28 
29 TEST_CONSTEXPR_CXX20 bool test() {
30   {
31     typedef std::string S;
32     test(S());
33     test(S("123"));
34   }
35 #if TEST_STD_VER >= 11
36   {
37     typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
38     test(S());
39     test(S("123"));
40   }
41 #endif
42 
43   return true;
44 }
45 
46 int main(int, char**)
47 {
48   test();
49 #if TEST_STD_VER > 17
50   static_assert(test());
51 #endif
52   return 0;
53 }
54