Open Quuxplusone opened 6 years ago
clang-tidy logs only one bool-pointer-implicit-conversion warning for following code:
bool test(bool* pointer_to_bool) { if (pointer_to_bool) { // warning, as expected :) }
return pointer_to_bool; // no warning, but why not? :(
}
The return pointer_to_bool statement uses pointer_to_bool in a boolean expression but doesn't trigger a warning.
return pointer_to_bool
clang-tidy --checks="-*,misc-bool-pointer-implicit-conversion" bool-pointer-implicit-conversion.cpp
bool-pointer-implicit-conversion.cpp:5:7: warning: dubious check of 'bool ' against 'nullptr', did you mean to dereference it? [misc-bool-pointer-implicit-conversion] if (pointer_to_bool) { // warning ^
https://clang.llvm.org/extra/clang-tidy/checks/bugprone-bool-pointer-implicit-conversion.html
if (!pointer_to_bool) {} does not trigger a bool-pointer-implicit-conversion warning, either.
if (!pointer_to_bool) {}
clang-tidy logs only one bool-pointer-implicit-conversion warning for following code:
bool test(bool* pointer_to_bool) { if (pointer_to_bool) { // warning, as expected :) }
}
The
return pointer_to_bool
statement uses pointer_to_bool in a boolean expression but doesn't trigger a warning.clang-tidy --checks="-*,misc-bool-pointer-implicit-conversion" bool-pointer-implicit-conversion.cpp
bool-pointer-implicit-conversion.cpp:5:7: warning: dubious check of 'bool ' against 'nullptr', did you mean to dereference it? [misc-bool-pointer-implicit-conversion] if (pointer_to_bool) { // warning ^
https://clang.llvm.org/extra/clang-tidy/checks/bugprone-bool-pointer-implicit-conversion.html