1515#include " test_macros.h"
1616#include " min_allocator.h"
1717
18- // TODO: add constexpr to this test as well
19-
2018// [container.node.overview] Table 83.
2119template <class K , class T , class C1 , class C2 , class H1 , class H2 , class E1 , class E2 , class A_set , class A_map >
2220struct node_compatibility_table {
@@ -109,7 +107,7 @@ static_assert(
109107 " " );
110108
111109template <class Container >
112- void test_node_handle_operations () {
110+ TEST_CONSTEXPR_CXX26 bool test_node_handle_operations () {
113111 Container c;
114112
115113 typename Container::node_type nt1, nt2 = c.extract (c.emplace ().first );
@@ -119,10 +117,12 @@ void test_node_handle_operations() {
119117 std::swap (nt1, nt2);
120118 assert (nt1.get_allocator () == c.get_allocator ());
121119 assert (nt2.empty ());
120+
121+ return true ;
122122}
123123
124124template <class Container >
125- void test_node_handle_operations_multi () {
125+ TEST_CONSTEXPR_CXX26 bool test_node_handle_operations_multi () {
126126 Container c;
127127
128128 typename Container::node_type nt1, nt2 = c.extract (c.emplace ());
@@ -132,30 +132,51 @@ void test_node_handle_operations_multi() {
132132 std::swap (nt1, nt2);
133133 assert (nt1.get_allocator () == c.get_allocator ());
134134 assert (nt2.empty ());
135+
136+ return true ;
135137}
136138
137139template <class >
138- void test_typedef () {}
140+ TEST_CONSTEXPR_CXX26 bool test_typedef () { return true ; }
139141
140142template <class Container >
141- void test_insert_return_type () {
143+ TEST_CONSTEXPR_CXX26 bool test_insert_return_type () {
142144 test_typedef<typename Container::insert_return_type>();
145+ return true ;
143146}
144147
145- int main (int , char **) {
148+ TEST_CONSTEXPR_CXX26 bool test () {
149+
146150 test_node_handle_operations<std::map<int , int >>();
151+
152+ // FIXME: update when other containers are made constexpr
153+ if (!TEST_IS_CONSTANT_EVALUATED)
154+ {
147155 test_node_handle_operations_multi<std::multimap<int , int >>();
148156 test_node_handle_operations<std::set<int >>();
149157 test_node_handle_operations_multi<std::multiset<int >>();
150158 test_node_handle_operations<std::unordered_map<int , int >>();
151159 test_node_handle_operations_multi<std::unordered_multimap<int , int >>();
152160 test_node_handle_operations<std::unordered_set<int >>();
153161 test_node_handle_operations_multi<std::unordered_multiset<int >>();
162+ }
154163
155164 test_insert_return_type<std::map<int , int >>();
165+
166+ // FIXME: update when other containers are made constexpr
167+ if (!TEST_IS_CONSTANT_EVALUATED)
168+ {
156169 test_insert_return_type<std::set<int >>();
157170 test_insert_return_type<std::unordered_map<int , int >>();
158171 test_insert_return_type<std::unordered_set<int >>();
172+ }
173+ return true ;
174+ }
159175
176+ int main (int , char **) {
177+ assert (test ());
178+ #if TEST_STD_VER >= 26
179+ static_assert (test ());
180+ #endif
160181 return 0 ;
161182}
0 commit comments