Skip to content

Commit

Permalink
Format code and add tests\GH_004597_self_swap into test.lst
Browse files Browse the repository at this point in the history
  • Loading branch information
Andor233 committed May 14, 2024
1 parent 706bb57 commit fe0d85e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions tests/std/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ tests\GH_004201_chrono_formatter
tests\GH_004275_seeking_fancy_iterators
tests\GH_004388_unordered_meow_operator_equal
tests\GH_004477_mdspan_warning_5246
tests\GH_004597_self_swap
tests\GH_004618_mixed_operator_usage_keeps_statistical_properties
tests\GH_004618_normal_distribution_avoids_resets
tests\LWG2381_num_get_floating_point
Expand Down
7 changes: 2 additions & 5 deletions tests/std/tests/GH_004597_self_swap/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <cassert>
#include <utility>

// Test GH-4597 "<utility>: Side effects in self-swaps of pair are skipped"
struct swap_counter {
unsigned int* pcnt_ = nullptr;

Expand Down Expand Up @@ -66,15 +65,13 @@ _CONSTEXPR20 bool test_gh_4595() {
p1.swap(p2);
return (c1 == 1u) && (c2 == 3u) && (p1.first == 3u) && (p1.second == 3) && (p2.first == 1u) && (p2.second == 1);
}();

#endif
#endif // _HAS_CXX23
return res1 && res2 && res3 && res4;
}

int main() {
#if _HAS_CXX20
static_assert(test_gh_4595());
#else
#endif // _HAS_CXX20
assert(test_gh_4595());
#endif
}

0 comments on commit fe0d85e

Please sign in to comment.