| 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 | // <forward_list> |
| 10 | |
| 11 | // forward_list(); // constexpr since C++26 |
| 12 | |
| 13 | #include <forward_list> |
| 14 | #include <cassert> |
| 15 | |
| 16 | #include "test_macros.h" |
| 17 | #include "min_allocator.h" |
| 18 | |
| 19 | TEST_CONSTEXPR_CXX26 bool test() { |
| 20 | { |
| 21 | typedef int T; |
| 22 | typedef std::forward_list<T> C; |
| 23 | C c; |
| 24 | assert(c.empty()); |
| 25 | } |
| 26 | #if TEST_STD_VER >= 11 |
| 27 | { |
| 28 | typedef int T; |
| 29 | typedef std::forward_list<T, min_allocator<T>> C; |
| 30 | C c; |
| 31 | assert(c.empty()); |
| 32 | } |
| 33 | { |
| 34 | typedef int T; |
| 35 | typedef std::forward_list<T> C; |
| 36 | C c = {}; |
| 37 | assert(c.empty()); |
| 38 | } |
| 39 | #endif |
| 40 | |
| 41 | return true; |
| 42 | } |
| 43 | |
| 44 | int main(int, char**) { |
| 45 | assert(test()); |
| 46 | #if TEST_STD_VER >= 26 |
| 47 | static_assert(test()); |
| 48 | #endif |
| 49 | |
| 50 | return 0; |
| 51 | } |
| 52 | |