blob: 97b54553427d93d3c6a3d1dfff61b1131dfa9753 [file] [log] [blame]
Artyom Skrobov9f213442014-01-24 11:10:39 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3template<int I>
4struct TS {
5 __attribute__((returns_nonnull))
6 void *value_dependent(void) {
7 return I; // no-warning
8 }
9
10 __attribute__((returns_nonnull))
11 void *value_independent(void) {
12 return 0; // expected-warning {{null returned from function that requires a non-null return value}}
13 }
14};
15
Richard Smith588bd9b2014-08-27 04:59:42 +000016namespace Template {
17 template<typename T> __attribute__((nonnull)) void f(T t);
18 void g() { f((void*)0); } // expected-warning {{null passed to a callee that requires a non-null argument}}
19 void h() { f(0); }
20}