We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In C, the result of a comparison is defined as returning a 1 or a 0 of type int (C N3220 6.5.9.7 & 6.5.10.4).
1
0
int
https://godbolt.org/z/fTErfvzqW
bool foo() { return 1 != 0; }
[<source>:1:21: warning: implicit conversion 'int' -> 'bool' [readability-implicit-bool-conversion]](javascript:;) 1 | bool foo() { return 1 != 0; } | ^ | ( ) != 0 1 warning generated.
The check should probably be adapted to check if the source expression of the cast is a comparison (ignoring parens), and just add a cast instead.
Additionally, a new option could be added to ignore the conversion warning in this case for C.
The text was updated successfully, but these errors were encountered:
@llvm/issue-subscribers-bug
Author: Julian Schmidt (5chmidti)
[<source>:1:21: warning: implicit conversion 'int' -> 'bool' [readability-implicit-bool-conversion]](javascript:;) 1 | bool foo() { return 1 != 0; } | ^ | ( ) != 0 1 warning generated.
Sorry, something went wrong.
@llvm/issue-subscribers-clang-tidy
No branches or pull requests
In C, the result of a comparison is defined as returning a
1
or a0
of typeint
(C N3220 6.5.9.7 & 6.5.10.4).https://godbolt.org/z/fTErfvzqW
The check should probably be adapted to check if the source expression of the cast is a comparison (ignoring parens), and just add a cast instead.
Additionally, a new option could be added to ignore the conversion warning in this case for C.
The text was updated successfully, but these errors were encountered: