Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: comparison of integers of different signs: 'const int' and 'const unsigned long' #1752

Closed
yurivict opened this issue Aug 18, 2018 · 4 comments

Comments

@yurivict
Copy link

The build of google/benchmark fails:

In file included from /usr/ports/devel/benchmark/work/benchmark-1.4.1-25-gaf441fc/test/string_util_gtest.cc:6:
/usr/local/include/gtest/gtest.h:1421:11: error: comparison of integers of different signs: 'const int' and 'const unsigned long' [-Werror,-Wsign-compare]
  if (lhs == rhs) {
      ~~~ ^  ~~~
/usr/local/include/gtest/gtest.h:1487:12: note: in instantiation of function template specialization 'testing::internal::CmpHelperEQ<int, unsigned long>' requested here
    return CmpHelperEQ(lhs_expression, rhs_expression, lhs, rhs);
           ^
/usr/ports/devel/benchmark/work/benchmark-1.4.1-25-gaf441fc/test/string_util_gtest.cc:12:5: note: in instantiation of function template specialization 'testing::internal::EqHelper<true>::Compare<int, unsigned long>' requested here
    EXPECT_EQ(0, benchmark::stoul("0", &pos));
    ^
/usr/local/include/gtest/gtest.h:1945:63: note: expanded from macro 'EXPECT_EQ'
                      EqHelper<GTEST_IS_NULL_LITERAL_(val1)>::Compare, \
                                                              ^
@jbeich
Copy link

jbeich commented Aug 19, 2018

0 is int while benchmark::stoul() returns unsigned long. Maybe add UL suffix to the integer constant or drop -Werror.

@gennadiycivil
Copy link
Contributor

I have been cleaning up older and inactive GitHub googletest issues. You may see an issue "closed" if it appears to be inactive/abandoned
Thank you

@jhasse
Copy link

jhasse commented Apr 18, 2019

Still happens in master branch. Can you reopen the issue?

@jonesmz
Copy link

jonesmz commented Aug 4, 2019

@gennadiycivil

Please reopen this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants