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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to