diff options
Diffstat (limited to 'clang/test/Sema/nonnull.c')
-rw-r--r-- | clang/test/Sema/nonnull.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/Sema/nonnull.c b/clang/test/Sema/nonnull.c index de47e9664ca..4b3df8518cf 100644 --- a/clang/test/Sema/nonnull.c +++ b/clang/test/Sema/nonnull.c @@ -141,3 +141,15 @@ void yet_another_evil_nonnull_func(int* pointer) } } +void pr21668_1(__attribute__((nonnull)) const char *p, const char *s) { + if (p) // expected-warning {{nonnull parameter 'p' will evaluate to 'true' on first encounter}} + ; + if (s) // No warning + ; +} + +void pr21668_2(__attribute__((nonnull)) const char *p) { + p = 0; + if (p) // No warning + ; +} |