-
-
Notifications
You must be signed in to change notification settings - Fork 651
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
GCC 5.3.1 Compiler warning: sign compare #16
Comments
Well the compiler is right isn't it? Using Edit: |
well... I don't get a warning for a normal if statement like |
With GNU 5.2.0 on Windows I also get the warning for |
Catch actively suppresses signed/unsigned mismatch for the expression decomposer. Edit: ... for MSVC |
So I asked these 2 questions on SO and didn't get the nice explanation I was hoping for. Atleast I have a conclusion: Here is a summary that shows the issue:
int a = 0;
unsigned b = 0;
if(a == b)
const int a = 0;
const unsigned b = 0;
if(a == b)
const int& a = 0;
const unsigned& b = 0;
if(a == b) I don't like the way Catch handles this in gcc/clang - all those templates and specializations must have a compile time performance overhead. The way I've chosen is to disable the few relevant warnings in the templated code, and the user will be able to remove these warning suppressions with the The downside of this will be that code that should generate a warning will not by default (unless that identifier is defined before the inclusion of doctest) |
…e machinery - comparing signed to unsigned integers should now not generate warnings... If this behavior is not desired the user may use the DOCTEST_CONFIG_NO_COMPARISON_WARNING_SUPPRESSION identifier to remove the suppression of warnings. This was done mainly so code like CHECK(vec.size() == 0) would compile cleanly. fixed #16
Compiler:
g++ (Debian 5.3.1-21) 5.3.1 20160528
Code:
Command line (unimportant flags like include paths removed):
Result (full paths removed):
The text was updated successfully, but these errors were encountered: