[LLVMbugs] [Bug 15983] New: Warn on most likely unintentional use of implicit boolean conversion in compare.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon May 13 11:19:52 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=15983

            Bug ID: 15983
           Summary: Warn on most likely unintentional use of implicit
                    boolean conversion in compare.
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: benny.kra at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

struct Foo {
  int c;

  operator bool() const { return c != 0; }
};

bool foo(Foo a, Foo b) {
  return a == b;
}

This is equivalent to (a.c != 0) == (b.c != 0), most likely not what was
intended here. I think we should warn about this.

-- 
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/20130513/7c4ecdc6/attachment.html>


More information about the llvm-bugs mailing list