[LLVMbugs] [Bug 13645] New: No warning when passing a null pointer template parameter as a nonnull attributed argument to a function call
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Aug 19 22:50:49 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=13645
Bug #: 13645
Summary: No warning when passing a null pointer template
parameter as a nonnull attributed argument to a
function call
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++11
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: dblaikie at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Test case produces no warnings:
void func(int*) __attribute__((nonnull (1)));
template<int* P>
void func() {
func(P); // expect warning from passing null constant to a non-null arg
}
int main() {
func<nullptr>(); // expect note for the template backtrace
}
(extra credit: We also don't warn for this:
constexpr int *x = nullptr;
func<x>();
I'm not sure if this'll come out for free while fixing the more direct case, or
whether we should go far out of our way to catch it if it doesn't, but I
thought I'd mention it in case someone ends up trying)
--
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