summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/attr-nonnull.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-03-25 01:44:32 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-03-25 01:44:32 +0000
commit909a70d8a185f701c20bacc3c76f8f5979cbbc7c (patch)
treecb7a231d18b78b008ad9fea89388cb523433f428 /test/SemaCXX/attr-nonnull.cpp
parent2a523eec6a31955be876625819b89e8dc5def707 (diff)
Apply the nonnull attribute to constructor expressions too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128253 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/attr-nonnull.cpp')
-rw-r--r--test/SemaCXX/attr-nonnull.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/SemaCXX/attr-nonnull.cpp b/test/SemaCXX/attr-nonnull.cpp
index 19d6642eb5..09c054c197 100644
--- a/test/SemaCXX/attr-nonnull.cpp
+++ b/test/SemaCXX/attr-nonnull.cpp
@@ -1,5 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
struct S {
+ S(const char *) __attribute__((nonnull(2)));
+
static void f(const char*, const char*) __attribute__((nonnull(1)));
// GCC has a hidden 'this' argument in member functions, so the middle
@@ -10,7 +12,9 @@ struct S {
expected-error{{invalid for the implicit this argument}}
};
-void test(S s) {
+void test() {
+ S s(0); // expected-warning{{null passed}}
+
s.f(0, ""); // expected-warning{{null passed}}
s.f("", 0);
s.g("", 0, ""); // expected-warning{{null passed}}