Skip to content

Commit

Permalink
tests: Work around -Wself-move in new gcc
Browse files Browse the repository at this point in the history
We do want to test self-move; fortunately, hiding the object reference
behind a separate pointer variable silences the warning.
  • Loading branch information
zeux committed Nov 16, 2023
1 parent 43d7d56 commit 2e8a2a4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/test_xpath_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,8 @@ TEST_XML(xpath_api_nodeset_move_assign_self, "<node><foo/><foo/><bar/></node>")

test_runner::_memory_fail_threshold = 1;

set = std::move(*&set);
xpath_node_set* self = &set;
set = std::move(*self);
}

TEST(xpath_api_query_move)
Expand Down Expand Up @@ -614,7 +615,8 @@ TEST(xpath_api_query_move)
CHECK(q4);
CHECK(q4.evaluate_boolean(c));

q4 = std::move(*&q4);
xpath_query* q4self = &q4;
q4 = std::move(*q4self);

CHECK(q4);
CHECK(q4.evaluate_boolean(c));
Expand Down

0 comments on commit 2e8a2a4

Please sign in to comment.