calvert1991/googlemock

Multiple GCC warnings on TypedEq

Opened this issue · 2 comments

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

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

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