minix/external/bsd/llvm/dist/clang/test/Sema/crash-invalid-array.c
Lionel Sambuc f4a2713ac8 Importing netbsd clang -- pristine
Change-Id: Ia40e9ffdf29b5dab2f122f673ff6802a58bc690f
2014-07-28 17:05:57 +02:00

24 lines
900 B
C

// RUN: not %clang_cc1 -O1 %s -emit-llvm
// PR6913
#include <stdio.h>
int main()
{
int x[10][10];
int (*p)[] = x; // expected-error {{invalid use of array with unspecified bounds}
int i;
for(i = 0; i < 10; ++i)
{
p[i][i] = i;
}
}
// rdar://13705391
void foo(int a[*][2]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
void foo1(int a[2][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
void foo2(int a[*][*]) {(void)a[0][1]; } // expected-error {{variable length array must be bound in function definition}}
void foo3(int a[2][*][2]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}
void foo4(int a[2][*][*]) {(void)a[0][1][1]; } // expected-error {{variable length array must be bound in function definition}}