Alp Toker | 7c265cf | 2013-12-08 22:37:30 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -triple=x86_64-apple-darwin -fsyntax-only -verify %s |
Eric Christopher | 516a79e | 2011-07-22 07:26:22 +0000 | [diff] [blame] | 2 | // PR6913 |
| 3 | |
Eric Christopher | 516a79e | 2011-07-22 07:26:22 +0000 | [diff] [blame] | 4 | int main() |
| 5 | { |
| 6 | int x[10][10]; |
Alp Toker | 2e41264 | 2013-12-08 22:22:26 +0000 | [diff] [blame] | 7 | int (*p)[] = x; |
Eric Christopher | 516a79e | 2011-07-22 07:26:22 +0000 | [diff] [blame] | 8 | |
| 9 | int i; |
| 10 | |
| 11 | for(i = 0; i < 10; ++i) |
| 12 | { |
Alp Toker | 2e41264 | 2013-12-08 22:22:26 +0000 | [diff] [blame] | 13 | p[i][i] = i; // expected-error {{subscript of pointer to incomplete type 'int []'}} |
Eric Christopher | 516a79e | 2011-07-22 07:26:22 +0000 | [diff] [blame] | 14 | } |
| 15 | } |
Fariborz Jahanian | 4289a5a | 2013-04-29 22:01:25 +0000 | [diff] [blame] | 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}} |