blob: 2d4b968decdae7fb90d026bdade66df0232240d0 [file] [log] [blame]
Peter Collingbourne20cdbeb2011-10-16 21:17:32 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3void cat0(int a[static 0]) {} // expected-warning {{'static' has no effect on zero-length arrays}}
4
5void cat(int a[static 3]) {} // expected-note 2 {{callee declares array parameter as static here}}
6
7typedef int i3[static 3];
8void tcat(i3 a) {}
9
10void vat(int i, int a[static i]) {} // expected-note {{callee declares array parameter as static here}}
11
12void 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}