[llvm-bugs] [Bug 25964] New: -Wliteral-conversion diagnostic with negative values could be improved

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 29 13:17:18 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25964

            Bug ID: 25964
           Summary: -Wliteral-conversion diagnostic with negative values
                    could be improved
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: aaron at aaronballman.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Consider the following code:

void f() {
  bool b1 = -0.99f;
}

This produces the diagnostic: implicit conversion from 'float' to 'bool'
changes value from 0.99 to true

While it's valid to drop the negative sign in the diagnostic (because that's
not part of the literal value, but is instead an expression), it can still be a
bit confusing to users. It might fit programmer's mental models more closely
for the diagnostic to print -0.99 instead.

-- 
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/3c935c48/attachment.html>


More information about the llvm-bugs mailing list