clm971910 / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

EXPECT_EQ(kFalseConstant, ...) issues warning with GCC 4.7 and higher #458

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
For example if we have:
const bool kFalseConstant = false;
EXPECT_EQ(kFalseConstant, foo());

GCC 4.7 will issue the following warning:
converting 'false' to pointer type for argument 1 of 'char 
testing::internal::IsNullLiteralHelper(testing::internal::Secret*)'

We are using the following workaround in Chromium:
EXPECT_TRUE(kFalseConstant == foo());

Though I'm not sure if it the expected behavior to consider kFalseConstant as 
compatible to null pointer. (why EXPECT_EQ has to check that anyway?) It may be 
a bug or not.

Original issue reported on code.google.com by trc...@chromium.org on 16 May 2014 at 11:38