[LLVMbugs] [Bug 7443] New: NullToMemberPointer cast used when a regular cast should be used instead

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 21 14:44:29 PDT 2010


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

           Summary: NullToMemberPointer cast used when a regular cast
                    should be used instead
           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


Consider the following example:

$ cat t.cpp
  return p == __null;
}

$ clang -Xclang -ast-dump -fsyntax-only t.cpp
int foo(int *p) (CompoundStmt 0x101039388 <t.cpp:1:17, line:3:1>
  (ReturnStmt 0x101039360 <line:2:3, col:15>
    (ImplicitCastExpr 0x101039328 <col:10, col:15> 'int' <IntegralCast>
      (BinaryOperator 0x1010392f0 <col:10, col:15> '_Bool' '=='
        (DeclRefExpr 0x101039268 <col:10> 'int *' ParmVar='p' 0x101039130)
        (ImplicitCastExpr 0x1010392b8 <col:15> 'int *' <NullToMemberPointer>
          (GNUNullExpr 0x101039298 <col:15> 'long'))))))


Notice that the type of the cast is wrong:

        (ImplicitCastExpr 0x1010392b8 <col:15> 'int *' <NullToMemberPointer>

This shouldn't be a NullToMemberPointer cast, since int* isn't a member
pointer.

-- 
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