[LLVMbugs] [Bug 13165] New: regression: clang suggests a fixit to replace NULL with NULL

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 21 11:13:35 PDT 2012


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

             Bug #: 13165
           Summary: regression: clang suggests a fixit to replace NULL
                    with NULL
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nicolasweber at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


hummer:src thakis$ cat test.cc
#include <stddef.h>

template <typename T> class SkRefPtr {
public:
    SkRefPtr() : fObj(NULL) {}

    T* get() const { return fObj; }

    typedef T* SkRefPtr::*unspecified_bool_type;
    operator unspecified_bool_type() const {
        return fObj ? &SkRefPtr::fObj : NULL;
    }

private:
    T* fObj;
};

void f() {
  SkRefPtr<int> p;
  if (p == NULL)
    ;
}
hummer:src thakis$ ~/src/llvm-svn/Release+Asserts/bin/clang -c test.cc -Wall
-Wextra
test.cc:20:12: warning: implicit conversion of NULL constant to 'int
*SkRefPtr<int>::*' [-Wnull-conversion]
  if (p == NULL)
        ~~ ^~~~
           NULL
test.cc:11:41: warning: implicit conversion of NULL constant to 'int
*SkRefPtr<int>::*' [-Wnull-conversion]
        return fObj ? &SkRefPtr::fObj : NULL;
        ~~~~~~                          ^~~~
                                        NULL
test.cc:20:7: note: in instantiation of member function
'SkRefPtr<int>::operator int *class SkRefPtr<int>::*' requested here
  if (p == NULL)
      ^
2 warnings generated.


Probably caused by r158744?

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