Skip to content

Commit

Permalink
Fix -Wpointer-bool-conversion violation
Browse files Browse the repository at this point in the history
Summary:
Fixing warning exposed by -Wpointer-bool-conversion

```
 folly/container/test/F14MapTest.cpp:1370:35: error: address of function 'Tracked<0>::counts' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
            << "key_type ops " << Tracked<0>::counts << ", mapped_type ops "
                               ~~ ^~~~~~~~~~~~~~~~~~
folly/container/test/F14MapTest.cpp:1370:35: note: prefix with the address-of operator to silence this warning
            << "key_type ops " << Tracked<0>::counts << ", mapped_type ops "
                                  ^
                                  &
folly/container/test/F14MapTest.cpp:1371:16: error: address of function 'Tracked<1>::counts' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
            << Tracked<1>::counts;
            ~~ ^~~~~~~~~~~~~~~~~~
folly/container/test/F14MapTest.cpp:1371:16: note: prefix with the address-of operator to silence this warning
            << Tracked<1>::counts;
               ^
               &
2 errors generated.

Reviewed By: yfeldblum

Differential Revision: D19131722

fbshipit-source-id: 9db48848ab5d68bc73ab0d6a4ef557d0db05414e
Lilit Yenokyan authored and facebook-github-bot committed Dec 19, 2019
1 parent 80fc6c6 commit 764cdc0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions folly/container/test/F14MapTest.cpp
Original file line number Diff line number Diff line change
@@ -1367,8 +1367,8 @@ TEST(F14VectorMap, destructuringErase) {
resetTracking();
m.erase(p1.first);
LOG(INFO) << "erase -> "
<< "key_type ops " << Tracked<0>::counts << ", mapped_type ops "
<< Tracked<1>::counts;
<< "key_type ops " << Tracked<0>::counts() << ", mapped_type ops "
<< Tracked<1>::counts();
// deleting p1 will cause p2 to be moved to the front of the values array
EXPECT_EQ(
Tracked<0>::counts().dist(Counts{0, 1, 0, 0}) +

0 comments on commit 764cdc0

Please sign in to comment.