diff options
author | Ankit Meel <ankitjmeel@gmail.com> | 2022-01-14 19:36:53 +0300 |
---|---|---|
committer | Ankit Meel <ankitjmeel@gmail.com> | 2022-01-14 19:40:28 +0300 |
commit | d723fa3d3165b02db7d6ebd0c90c4c563baec837 (patch) | |
tree | 2383580dcdbdd2788f99086887fa88e5107c4bd4 /source/blender/blenlib/tests | |
parent | 780633ec4b4148f146617acceda14172fd32750a (diff) |
blenlib Any tests: Fix unknown pragma warning on Windows.
Part of a5cb7c1e62a07c17e346278b1c4e9ea58c9f54e0 is reverted since it
created unknown pragma warning on windows.
Use a trick to do self-assigning.
Reviewed by Jacques Lucke in chat.
Diffstat (limited to 'source/blender/blenlib/tests')
-rw-r--r-- | source/blender/blenlib/tests/BLI_any_test.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/source/blender/blenlib/tests/BLI_any_test.cc b/source/blender/blenlib/tests/BLI_any_test.cc index d5871f46192..3a5cbee6d72 100644 --- a/source/blender/blenlib/tests/BLI_any_test.cc +++ b/source/blender/blenlib/tests/BLI_any_test.cc @@ -53,11 +53,9 @@ 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; -#pragma clang diagnostic pop + /* Test valid state after self assignment. Clang emits `-Wself-assign-overloaded` with `c=c;`. + * And pragma suppression creates warnings on other compilers. */ + c = static_cast<decltype(a) &>(c); EXPECT_TRUE(c); EXPECT_EQ((c.get<Map<int, int>>().lookup(4)), 2); |