summaryrefslogtreecommitdiff
path: root/test/SemaCXX/nonnull.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/nonnull.cpp')
-rw-r--r--test/SemaCXX/nonnull.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/SemaCXX/nonnull.cpp b/test/SemaCXX/nonnull.cpp
new file mode 100644
index 000000000000..9ff6d115bd16
--- /dev/null
+++ b/test/SemaCXX/nonnull.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+template<int I>
+struct TS {
+ __attribute__((returns_nonnull))
+ void *value_dependent(void) {
+ return I; // no-warning
+ }
+
+ __attribute__((returns_nonnull))
+ void *value_independent(void) {
+ return 0; // expected-warning {{null returned from function that requires a non-null return value}}
+ }
+};
+