[LLVMbugs] [Bug 12378] New: -Wnull-conversion doesn't complain about default arguments in templates

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 27 14:41:10 PDT 2012


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

             Bug #: 12378
           Summary: -Wnull-conversion doesn't complain about default
                    arguments in templates
           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 <class T>
class A {
 public:
  void f(T t = NULL) {  // doesn't warn
    t_ = NULL;  // warns
  }
  T t_;
};

int main() {
  A<int> a;
  a.f();
}
hummer:src thakis$ ~/src/llvm-svn/Release+Asserts/bin/clang -c test.cc
test.cc:7:10: warning: implicit conversion of NULL constant to 'int'
[-Wnull-conversion]
    t_ = NULL;
       ~ ^~~~
test.cc:14:5: note: in instantiation of member function 'A<int>::f' requested
here
  a.f();
    ^
1 warning generated.


Seems a bit inconsistent.

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