[LLVMbugs] [Bug 7395] New: clang does not reject invalid conversion from method to bool

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 16 22:18:14 PDT 2010


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

           Summary: clang does not reject invalid conversion from method
                    to bool
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: kremenek at apple.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


gcc rejects the following code, but clang does not:

(kremenek at gruebook:tmp)$ cat t.cpp
#include <assert.h>

class Foo {
public:
  void set() {}
  void test() {
    assert(set);
  }
};
(kremenek at gruebook:tmp)$ gcc -c t.cpp
t.cpp: In member function ‘void Foo::test()’:
t.cpp:7: error: could not convert ‘((Foo*)this)->Foo::set’ to ‘bool’
t.cpp:7: error: in argument to unary !
(kremenek at gruebook:tmp)$ clang -c t.cpp
(kremenek at gruebook:tmp)$

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list