| 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 | // explicit forward_list(const allocator_type& a); // constexpr since C++26 |
| 12 | |
| 13 | #include <forward_list> |
| 14 | #include <cassert> |
| 15 | |
| 16 | #include "test_allocator.h" |
| 17 | #include "../../../NotConstructible.h" |
| 18 | |
| 19 | TEST_CONSTEXPR_CXX26 bool test() { |
| 20 | { |
| 21 | typedef test_allocator<NotConstructible> A; |
| 22 | typedef A::value_type T; |
| 23 | typedef std::forward_list<T, A> C; |
| 24 | C c = A(12); |
| 25 | assert(c.get_allocator() == A(12)); |
| 26 | assert(c.empty()); |
| 27 | } |
| 28 | |
| 29 | return true; |
| 30 | } |
| 31 | |
| 32 | int main(int, char**) { |
| 33 | test(); |
| 34 | #if TEST_STD_VER >= 26 |
| 35 | static_assert(test()); |
| 36 | #endif |
| 37 | |
| 38 | return 0; |
| 39 | } |
| 40 | |