[llvm-bugs] [Bug 25467] New: Warn on pointer to bool conversion

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 9 15:46:17 PST 2015


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

            Bug ID: 25467
           Summary: Warn on pointer to bool conversion
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: matze at braunis.de
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

C/C++ have implicit conversions from pointers too bool. While this is nice for
if() statements, this often not useful in other contexts such as function
arguments, like the following example (which emits no warning with
-Weverything):

void print(bool verbose);

void func(void *pointer) {
  print(pointer);
}

It would be nice to provide a warning for these cases.

Note that -Wpointer-bool-conversion already exists but seems to deal with the
"if (function)" case where the programming forgot the function call braces and
the function pointer degrades to a bool.

-- 
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/20151109/6e74b37f/attachment.html>


More information about the llvm-bugs mailing list