Eric Christopher | 516a79e | 2011-07-22 07:26:22 +0000 | [diff] [blame] | 1 | // RUN: not %clang_cc1 -O1 %s -emit-llvm |
| 2 | // PR6913 |
| 3 | |
| 4 | #include <stdio.h> |
| 5 | |
| 6 | int main() |
| 7 | { |
| 8 | int x[10][10]; |
| 9 | int (*p)[] = x; // expected-error {{invalid use of array with unspecified bounds} |
| 10 | |
| 11 | int i; |
| 12 | |
| 13 | for(i = 0; i < 10; ++i) |
| 14 | { |
| 15 | p[i][i] = i; |
| 16 | } |
| 17 | } |
Fariborz Jahanian | 4289a5a | 2013-04-29 22:01:25 +0000 | [diff] [blame^] | 18 | |
| 19 | // rdar://13705391 |
| 20 | void foo(int a[*][2]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}} |
| 21 | void foo1(int a[2][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}} |
| 22 | void foo2(int a[*][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}} |
| 23 | void foo3(int a[2][*][2]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}} |
| 24 | void foo4(int a[2][*][*]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}} |