aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/attr-nonnull.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2013-01-23 05:08:29 +0000
committerNick Lewycky <nicholas@mxc.ca>2013-01-23 05:08:29 +0000
commit3edf387e4338ff98d9874b4c1b41d787e49d6c2b (patch)
tree7b7559d413384a092cfa3ef7cc985c698d58d2c1 /test/SemaCXX/attr-nonnull.cpp
parentd069c3d9cb8e858d3cb28e4d0a99a086c38453c5 (diff)
Make __attribute__((nonnull)) use the general expression evaluator to search for
nulls instead of limiting itself to the language-defined "null pointer constant". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173227 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/attr-nonnull.cpp')
-rw-r--r--test/SemaCXX/attr-nonnull.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/SemaCXX/attr-nonnull.cpp b/test/SemaCXX/attr-nonnull.cpp
index 09c054c197..76e1b74068 100644
--- a/test/SemaCXX/attr-nonnull.cpp
+++ b/test/SemaCXX/attr-nonnull.cpp
@@ -31,3 +31,12 @@ namespace rdar8769025 {
f2(0, 0); // expected-warning{{null passed to a callee which requires a non-null argument}}
}
}
+
+namespace test3 {
+__attribute__((nonnull(1))) void f(void *ptr);
+
+void g() {
+ f(static_cast<char*>((void*)0)); // expected-warning{{null passed}}
+ f(static_cast<char*>(0)); // expected-warning{{null passed}}
+}
+}