Peter Collingbourne | 20cdbeb | 2011-10-16 21:17:32 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | void cat0(int a[static 0]) {} // expected-warning {{'static' has no effect on zero-length arrays}} |
| 4 | |
| 5 | void cat(int a[static 3]) {} // expected-note 2 {{callee declares array parameter as static here}} |
| 6 | |
| 7 | typedef int i3[static 3]; |
| 8 | void tcat(i3 a) {} |
| 9 | |
| 10 | void vat(int i, int a[static i]) {} // expected-note {{callee declares array parameter as static here}} |
| 11 | |
| 12 | void f(int *p) { |
| 13 | int a[2], b[3], c[4]; |
| 14 | |
| 15 | cat0(0); |
| 16 | |
| 17 | cat(0); // expected-warning {{null passed to a callee which requires a non-null argument}} |
| 18 | cat(a); // expected-warning {{array argument is too small; contains 2 elements, callee requires at least 3}} |
| 19 | cat(b); |
| 20 | cat(c); |
| 21 | cat(p); |
| 22 | |
| 23 | tcat(0); // expected-warning {{null passed to a callee which requires a non-null argument}} |
| 24 | tcat(a); // expected-warning {{array argument is too small; contains 2 elements, callee requires at least 3}} |
| 25 | tcat(b); |
| 26 | tcat(c); |
| 27 | tcat(p); |
| 28 | |
| 29 | vat(1, 0); // expected-warning {{null passed to a callee which requires a non-null argument}} |
| 30 | vat(3, b); |
| 31 | } |