Skip to content

Commit 94f2235

Browse files
committed
test: work around bugprone-use-after-move warnings in util tests
```bash test/util_tests.cpp:2513:34: error: 't2' used after it was moved [bugprone-use-after-move,-warnings-as-errors] BOOST_CHECK(v2[0].origin == &t2); ^ test/util_tests.cpp:2511:15: note: move occurred here auto v2 = Vector(std::move(t2)); ^ test/util_tests.cpp:2519:34: error: 't2' used after it was moved [bugprone-use-after-move,-warnings-as-errors] BOOST_CHECK(v3[1].origin == &t2); ^ test/util_tests.cpp:2516:15: note: move occurred here auto v3 = Vector(t1, std::move(t2)); ^ test/util_tests.cpp:2527:34: error: 't3' used after it was moved [bugprone-use-after-move,-warnings-as-errors] BOOST_CHECK(v4[2].origin == &t3); ^ test/util_tests.cpp:2523:15: note: move occurred here auto v4 = Vector(std::move(v3[0]), v3[1], std::move(t3)); ```
1 parent cfda740 commit 94f2235

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/test/util_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2510,21 +2510,21 @@ BOOST_AUTO_TEST_CASE(test_tracked_vector)
25102510

25112511
auto v2 = Vector(std::move(t2));
25122512
BOOST_CHECK_EQUAL(v2.size(), 1U);
2513-
BOOST_CHECK(v2[0].origin == &t2);
2513+
BOOST_CHECK(v2[0].origin == &t2); // NOLINT(*-use-after-move)
25142514
BOOST_CHECK_EQUAL(v2[0].copies, 0);
25152515

25162516
auto v3 = Vector(t1, std::move(t2));
25172517
BOOST_CHECK_EQUAL(v3.size(), 2U);
25182518
BOOST_CHECK(v3[0].origin == &t1);
2519-
BOOST_CHECK(v3[1].origin == &t2);
2519+
BOOST_CHECK(v3[1].origin == &t2); // NOLINT(*-use-after-move)
25202520
BOOST_CHECK_EQUAL(v3[0].copies, 1);
25212521
BOOST_CHECK_EQUAL(v3[1].copies, 0);
25222522

25232523
auto v4 = Vector(std::move(v3[0]), v3[1], std::move(t3));
25242524
BOOST_CHECK_EQUAL(v4.size(), 3U);
25252525
BOOST_CHECK(v4[0].origin == &t1);
25262526
BOOST_CHECK(v4[1].origin == &t2);
2527-
BOOST_CHECK(v4[2].origin == &t3);
2527+
BOOST_CHECK(v4[2].origin == &t3); // NOLINT(*-use-after-move)
25282528
BOOST_CHECK_EQUAL(v4[0].copies, 1);
25292529
BOOST_CHECK_EQUAL(v4[1].copies, 1);
25302530
BOOST_CHECK_EQUAL(v4[2].copies, 0);

0 commit comments

Comments
 (0)