walterfan / googlemock

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

Multiple GCC warnings on TypedEq #175

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
GCC 4.4.3 gives multiple warnings when using TypedEq with an integral type:

  gmock.h:639: warning: comparison of unsigned expression < 0 is always false

Here's a simplified example of the code that triggers the warning:

  std::size_t n = 42;
  EXPECT_THAT(n, testing::TypedEq<std::size_t>(42));

Can be trivially fixed by changing the definition of GMOCK_IS_SIGNED_ to

  #define GMOCK_IS_SIGNED_(T) (std::numeric_limits<T>::is_signed)

Original issue reported on code.google.com by victor.z...@gmail.com on 4 May 2015 at 11:03

GoogleCodeExporter commented 9 years ago
Is this against trunk? If not, which version of gMock are you using?

Original comment by sbe...@google.com on 5 May 2015 at 1:52

GoogleCodeExporter commented 9 years ago
IIRC this is on version 1.7, but the issue reproduces on the trunk:

.../gmock/gmock.h:647: warning: comparison of unsigned expression < 0 is
always false

- Victor

Original comment by victor.z...@gmail.com on 6 May 2015 at 12:48