blob: dac335174f2db7dae28d3e551fc6923775a3478a [file] [log] [blame]
Alp Toker2e412642013-12-08 22:22:26 +00001// RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -verify %s
Eric Christopher516a79e2011-07-22 07:26:22 +00002// PR6913
3
4#include <stdio.h>
5
6int main()
7{
8 int x[10][10];
Alp Toker2e412642013-12-08 22:22:26 +00009 int (*p)[] = x;
Eric Christopher516a79e2011-07-22 07:26:22 +000010
11 int i;
12
13 for(i = 0; i < 10; ++i)
14 {
Alp Toker2e412642013-12-08 22:22:26 +000015 p[i][i] = i; // expected-error {{subscript of pointer to incomplete type 'int []'}}
Eric Christopher516a79e2011-07-22 07:26:22 +000016 }
17}
Fariborz Jahanian4289a5a2013-04-29 22:01:25 +000018
19// rdar://13705391
20void foo(int a[*][2]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
21void foo1(int a[2][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
22void foo2(int a[*][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
23void foo3(int a[2][*][2]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}
24void foo4(int a[2][*][*]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}