diff options
Diffstat (limited to 'test/Sema/static-array.c')
-rw-r--r-- | test/Sema/static-array.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/Sema/static-array.c b/test/Sema/static-array.c index 304485d5af..cc1043fe9c 100644 --- a/test/Sema/static-array.c +++ b/test/Sema/static-array.c @@ -1,8 +1,8 @@ -// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.14.0 -fsyntax-only -fblocks -verify %s void cat0(int a[static 0]) {} // expected-warning {{'static' has no effect on zero-length arrays}} -void cat(int a[static 3]) {} // expected-note 2 {{callee declares array parameter as static here}} +void cat(int a[static 3]) {} // expected-note 4 {{callee declares array parameter as static here}} expected-note 2 {{passing argument to parameter 'a' here}} void vat(int i, int a[static i]) {} // expected-note {{callee declares array parameter as static here}} @@ -19,6 +19,14 @@ void f(int *p) { vat(1, 0); // expected-warning {{null passed to a callee that requires a non-null argument}} vat(3, b); + + char d[4]; + cat((int *)d); // expected-warning {{array argument is too small; is of size 4, callee requires at least 12}} + cat(d); // expected-warning {{array argument is too small; is of size 4, callee requires at least 12}} expected-warning {{incompatible pointer types}} + + char e[12]; + cat((int *)e); + cat(e); // expected-warning {{incompatible pointer types}} } |