blenlib/ Any tests: fix self-assignment warning and typo

Fix assignment warning

source/blender/blenlib/tests/BLI_any_test.cc:56:5: warning: explicitly
assigning value of variable of type 'blender::Any<void, 8, 8>'
to itself [-Wself-assign-overloaded]
  c = c;

Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D13835
This commit is contained in:
Ankit Meel 2022-01-14 19:32:29 +05:30
parent 0cf746c1fa
commit a5cb7c1e62

@ -53,8 +53,12 @@ TEST(any, AssignMap)
EXPECT_EQ((b.get<Map<int, int>>().lookup(4)), 2);
Any<> c = std::move(a);
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wself-assign-overloaded"
/* Test valid state after self assignment. */
c = c;
EXPECT_TRUE(b);
#pragma clang diagnostic pop
EXPECT_TRUE(c);
EXPECT_EQ((c.get<Map<int, int>>().lookup(4)), 2);
EXPECT_TRUE((a.get<Map<int, int>>().is_empty())); /* NOLINT: bugprone-use-after-move */