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// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
10
11// template<container-compatible-range<T> R>
12// forward_list(from_range_t, R&& rg, const Allocator& = Allocator()); // C++23; constexpr since C++26
13
14#include <forward_list>
15
16#include "../../from_range_sequence_containers.h"
17#include "test_macros.h"
18
19TEST_CONSTEXPR_CXX26 bool test() {
20 for_all_iterators_and_allocators<int>([]<class Iter, class Sent, class Alloc>() {
21 test_sequence_container<std::forward_list, int, Iter, Sent, Alloc>([](const auto&) {
22 // No additional validation to do.
23 });
24 });
25 test_sequence_container_move_only<std::forward_list>();
26
27 static_assert(test_constraints<std::forward_list, int, double>());
28
29 if (!TEST_IS_CONSTANT_EVALUATED) {
30 test_exception_safety_throwing_copy<std::forward_list>();
31 test_exception_safety_throwing_allocator<std::forward_list, int>();
32 }
33
34 return true;
35}
36
37int main(int, char**) {
38 assert(test());
39#if TEST_STD_VER >= 26
40 static_assert(test());
41#endif
42
43 return 0;
44}
45

source code of libcxx/test/std/containers/sequences/forwardlist/forwardlist.cons/from_range.pass.cpp