blob: 029413b9843fe806c1a0d22faf6f667f7847ba7d [file] [log] [blame]
Alp Toker7c265cf2013-12-08 22:37:30 +00001// RUN: %clang_cc1 -triple=x86_64-apple-darwin -fsyntax-only -verify %s
Eric Christopher516a79e2011-07-22 07:26:22 +00002// PR6913
3
Eric Christopher516a79e2011-07-22 07:26:22 +00004int main()
5{
6 int x[10][10];
Alp Toker2e412642013-12-08 22:22:26 +00007 int (*p)[] = x;
Eric Christopher516a79e2011-07-22 07:26:22 +00008
9 int i;
10
11 for(i = 0; i < 10; ++i)
12 {
Alp Toker2e412642013-12-08 22:22:26 +000013 p[i][i] = i; // expected-error {{subscript of pointer to incomplete type 'int []'}}
Eric Christopher516a79e2011-07-22 07:26:22 +000014 }
15}
Fariborz Jahanian4289a5a2013-04-29 22:01:25 +000016
17// rdar://13705391
18void foo(int a[*][2]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
19void foo1(int a[2][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
20void foo2(int a[*][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
21void foo3(int a[2][*][2]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}
22void foo4(int a[2][*][*]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}