xref: /llvm-project/clang/test/Sema/crash-invalid-array.c (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1 // RUN: %clang_cc1 -triple=x86_64-apple-darwin -fsyntax-only -verify %s
2 // PR6913
3 
main(void)4 int main(void)
5 {
6    int x[10][10];
7    int (*p)[] = x;
8 
9    int i;
10 
11    for(i = 0; i < 10; ++i)
12    {
13        p[i][i] = i; // expected-error {{subscript of pointer to incomplete type 'int[]'}}
14    }
15 }
16 
foo(int a[* ][2])17 void foo(int a[*][2]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
foo1(int a[2][* ])18 void foo1(int a[2][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
foo2(int a[* ][* ])19 void foo2(int a[*][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
foo3(int a[2][* ][2])20 void foo3(int a[2][*][2]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}
foo4(int a[2][* ][* ])21 void foo4(int a[2][*][*]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}
22