[llvm-bugs] [Bug 25965] New: if (x) where x is a float emits a warning with -Wfloat-conversion
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Dec 29 14:06:19 PST 2015
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: unassignedclangbugs at nondot.org
Reporter: gpakosz at pempek.net
CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151229/63420b3f/attachment.html>
More information about the llvm-bugs
mailing list