]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Sema/crash-invalid-array.c
Vendor import of clang release_40 branch r292732:
[FreeBSD/FreeBSD.git] / test / Sema / crash-invalid-array.c
1 // RUN: %clang_cc1 -triple=x86_64-apple-darwin -fsyntax-only -verify %s
2 // PR6913
3
4 int main()
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
17 // rdar://13705391
18 void foo(int a[*][2]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
19 void foo1(int a[2][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
20 void foo2(int a[*][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
21 void foo3(int a[2][*][2]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}
22 void foo4(int a[2][*][*]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}