https://llvm.org/bugs/show_bug.cgi?id=25965
Bug ID: 25965 Summary: if (x) where x is a float emits a warning with -Wfloat-conversion Product: clang Version: 3.7 Hardware: PC OS: All Status: NEW Severity: normal Priority: P Component: Frontend Assignee: unassignedclangb...@nondot.org Reporter: gpak...@pempek.net CC: llvm-bugs@lists.llvm.org Classification: Unclassified int main(int argc, char* argv[]) { float f = argc; if (f) return 1; return 0; } --- $ clang -Wfloat-conversion main.c main.c:8:7: warning: implicit conversion turns floating-point number into integer: 'float' to 'bool' [-Wfloat-conversion] if (f) ~~ ^ As you can see, clang emits a warning while it seems to me everything non 0 should be converted to true. By comparison, gcc 5.2.0 emits no warning with this sample. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs