Chandler Carruth | 07d7e7a | 2010-11-16 08:35:43 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | struct S { |
| 3 | static void f(const char*, const char*) __attribute__((nonnull(1))); |
| 4 | |
| 5 | // GCC has a hidden 'this' argument in member functions, so the middle |
| 6 | // argument is the one that must not be null. |
| 7 | void g(const char*, const char*, const char*) __attribute__((nonnull(3))); |
| 8 | |
| 9 | void h(const char*) __attribute__((nonnull(1))); // \ |
| 10 | expected-error{{invalid for the implicit this argument}} |
| 11 | }; |
| 12 | |
| 13 | void test(S s) { |
| 14 | s.f(0, ""); // expected-warning{{null passed}} |
| 15 | s.f("", 0); |
| 16 | s.g("", 0, ""); // expected-warning{{null passed}} |
| 17 | s.g(0, "", 0); |
| 18 | } |