@@ -129,14 +129,23 @@ constexpr auto test_default_copy_assignment_from_non_empty(auto const make) -> v
129129 BOUNDED_ASSERT (containers::equal (target, Container ()));
130130}
131131template <typename Container>
132- constexpr auto test_copy_assignment_from_moved_from (auto const make) -> void {
132+ constexpr auto test_copy_assignment_from_move_constructed_from (auto const make) -> void {
133133 auto target = Container (make ());
134134 auto const source = std::move (target);
135135 target = source;
136136 BOUNDED_ASSERT (containers::equal (target, make ()));
137137 BOUNDED_ASSERT (containers::equal (target, source));
138138}
139139template <typename Container>
140+ constexpr auto test_copy_assignment_from_move_assigned_from (auto const make) -> void {
141+ auto target = Container (make ());
142+ auto source = Container (make ());
143+ source = std::move (target);
144+ target = source;
145+ BOUNDED_ASSERT (containers::equal (target, make ()));
146+ BOUNDED_ASSERT (containers::equal (target, source));
147+ }
148+ template <typename Container>
140149constexpr auto test_self_copy_assignment (auto const make) -> void {
141150 auto copy = Container (make ());
142151 // Turn off compiler warning for self assignment
@@ -146,11 +155,14 @@ constexpr auto test_self_copy_assignment(auto const make) -> void {
146155}
147156template <typename Container>
148157constexpr auto test_copy_assignment (auto const make) -> void {
149- test_copy_assignment_from_empty<Container>(make);
158+ if constexpr (bounded::default_constructible<Container>) {
159+ test_copy_assignment_from_empty<Container>(make);
160+ test_default_copy_assignment_from_empty<Container>();
161+ test_default_copy_assignment_from_non_empty<Container>(make);
162+ }
150163 test_copy_assignment_from_non_empty<Container>(make);
151- test_default_copy_assignment_from_empty<Container>();
152- test_default_copy_assignment_from_non_empty<Container>(make);
153- test_copy_assignment_from_moved_from<Container>(make);
164+ test_copy_assignment_from_move_constructed_from<Container>(make);
165+ test_copy_assignment_from_move_assigned_from<Container>(make);
154166 test_self_copy_assignment<Container>(make);
155167}
156168
@@ -169,13 +181,21 @@ constexpr auto test_move_assignment_from_non_empty(auto const make) -> void {
169181 BOUNDED_ASSERT (containers::equal (target, make ()));
170182}
171183template <typename Container>
172- constexpr auto test_move_assignment_from_moved_from (auto const make) -> void {
184+ constexpr auto test_move_assignment_from_move_constructed_from (auto const make) -> void {
173185 auto target = Container (make ());
174186 auto temp = std::move (target);
175187 target = std::move (temp);
176188 BOUNDED_ASSERT (containers::equal (target, make ()));
177189}
178190template <typename Container>
191+ constexpr auto test_move_assignment_from_move_assigned_from (auto const make) -> void {
192+ auto target = Container (make ());
193+ auto temp = Container (make ());
194+ temp = std::move (target);
195+ target = std::move (temp);
196+ BOUNDED_ASSERT (containers::equal (target, make ()));
197+ }
198+ template <typename Container>
179199constexpr auto test_recover_from_self_move (auto const make, auto const & validate) -> void {
180200 auto container = Container (make ());
181201 container = std::move (container);
@@ -194,9 +214,12 @@ constexpr auto test_self_move_assignment(auto const make, auto const & validate)
194214}
195215template <typename Container>
196216constexpr auto test_move_assignment (auto const make) -> void {
197- test_move_assignment_from_empty<Container>(make);
217+ if constexpr (bounded::default_constructible<Container>) {
218+ test_move_assignment_from_empty<Container>(make);
219+ }
198220 test_move_assignment_from_non_empty<Container>(make);
199- test_move_assignment_from_moved_from<Container>(make);
221+ test_move_assignment_from_move_constructed_from<Container>(make);
222+ test_move_assignment_from_move_assigned_from<Container>(make);
200223 test_self_move_assignment<Container>(make, [&](Container const & container) { return containers::equal (container, make ()); });
201224}
202225
@@ -240,7 +263,9 @@ constexpr auto test_special_members(auto const make) -> bool {
240263 test_copy_assignment<Container>(make);
241264 }
242265 }
243- test_assignment_from_empty_braces<Container>(make);
266+ if constexpr (bounded::default_constructible<Container>) {
267+ test_assignment_from_empty_braces<Container>(make);
268+ }
244269 test_swap (make);
245270 return true ;
246271}
@@ -256,14 +281,16 @@ constexpr auto test_sequence_container() -> bool {
256281 static_assert (containers::is_container<Container>);
257282 test_forward_range_concepts<Container>();
258283
259- test_range_based_for_loop<Container>();
284+ if constexpr (bounded::default_constructible<Container>) {
285+ test_range_based_for_loop<Container>();
260286
261- test_sequence_container_default_constructed_empty<Container>();
262- test_sequence_container_implicit_from_two_empty_braces<Container>();
287+ test_sequence_container_default_constructed_empty<Container>();
288+ test_sequence_container_implicit_from_two_empty_braces<Container>();
263289
264- test_sequence_container_from<Container>([] {
265- return containers::to_array<containers::range_value_t <Container>>({});
266- });
290+ test_sequence_container_from<Container>([] {
291+ return containers::to_array<containers::range_value_t <Container>>({});
292+ });
293+ }
267294 test_sequence_container_from<Container>([] {
268295 return containers::to_array<containers::range_value_t <Container>>({5 });
269296 });
0 commit comments