refactor: Revert "disable self-assign warning for tests"

This reverts commit 53372f21767be449bb452fc3f5fe7f16286ae371.
This commit is contained in:
MarcoFalke 2025-10-09 20:46:43 +02:00
parent faed118fb3
commit fa0fa0f700
No known key found for this signature in database
2 changed files with 0 additions and 29 deletions

View File

@ -580,20 +580,6 @@ BOOST_AUTO_TEST_CASE(conversion)
BOOST_AUTO_TEST_CASE(operator_with_self)
{
/* Clang 16 and earlier detects v -= v and v /= v as self-assignments
to 0 and 1 respectively.
See: https://github.com/llvm/llvm-project/issues/42469
and the fix in commit c5302325b2a62d77cf13dd16cd5c19141862fed0 .
This makes some sense for arithmetic classes, but could be considered a bug
elsewhere. Disable the warning here so that the code can be tested, but the
warning should remain on as there will likely always be a better way to
express this.
*/
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wself-assign-overloaded"
#endif
arith_uint256 v{2};
v *= v;
BOOST_CHECK_EQUAL(v, arith_uint256{4});
@ -603,9 +589,6 @@ BOOST_AUTO_TEST_CASE(operator_with_self)
BOOST_CHECK_EQUAL(v, arith_uint256{2});
v -= v;
BOOST_CHECK_EQUAL(v, arith_uint256{0});
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
}
BOOST_AUTO_TEST_SUITE_END()

View File

@ -199,19 +199,7 @@ FUZZ_TARGET(muhash)
},
[&] {
// Test that dividing a MuHash by itself brings it back to its initial state
// See note about clang + self-assignment in test/uint256_tests.cpp
#if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wself-assign-overloaded"
#endif
muhash /= muhash;
#if defined(__clang__)
# pragma clang diagnostic pop
#endif
muhash.Finalize(out);
out2 = initial_state_hash;
},