2007-11-01 10:45:17 +08:00
|
|
|
// RUN: clang %s -verify -fsyntax-only
|
|
|
|
|
|
|
|
typedef void (* fp)(void);
|
|
|
|
void foo(void);
|
|
|
|
fp a[1] = { foo };
|
|
|
|
|
2007-11-28 05:35:27 +08:00
|
|
|
int myArray[5] = {1, 2, 3, 4, 5};
|
|
|
|
int *myPointer2 = myArray;
|
|
|
|
int *myPointer = &(myArray[2]);
|
|
|
|
|
2007-12-02 15:47:49 +08:00
|
|
|
|
|
|
|
extern int x;
|
|
|
|
void *g = &x;
|
|
|
|
int *h = &x;
|
|
|
|
|
2008-02-08 08:48:24 +08:00
|
|
|
int test() {
|
|
|
|
int a[10];
|
|
|
|
int b[10] = a; // expected-error {{initialization with "{...}" expected}}
|
|
|
|
}
|
2008-05-04 09:13:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
// PR2050
|
|
|
|
struct cdiff_cmd {
|
|
|
|
const char *name;
|
|
|
|
unsigned short argc;
|
|
|
|
int (*handler)();
|
|
|
|
};
|
|
|
|
int cdiff_cmd_open();
|
|
|
|
struct cdiff_cmd commands[] = {
|
|
|
|
{"OPEN", 1, &cdiff_cmd_open }
|
|
|
|
};
|
|
|
|
|
2008-05-21 11:39:11 +08:00
|
|
|
// PR2348
|
|
|
|
static struct { int z; } s[2];
|
|
|
|
int *t = &(*s).z;
|
|
|
|
|
|
|
|
// PR2349
|
|
|
|
short *a2(void)
|
|
|
|
{
|
|
|
|
short int b;
|
2008-08-10 09:58:45 +08:00
|
|
|
static short *bp = &b; // expected-error {{initializer element is not a compile-time constant}}
|
2008-05-21 11:39:11 +08:00
|
|
|
|
|
|
|
return bp;
|
|
|
|
}
|
2008-05-31 02:07:22 +08:00
|
|
|
|
|
|
|
int pbool(void) {
|
|
|
|
typedef const _Bool cbool;
|
|
|
|
_Bool pbool1 = (void *) 0;
|
|
|
|
cbool pbool2 = &pbool;
|
|
|
|
return pbool2;
|
|
|
|
}
|
|
|
|
|
2008-08-19 08:58:40 +08:00
|
|
|
|
|
|
|
// rdar://5870981
|
|
|
|
union { float f; unsigned u; } u = { 1.0f };
|
|
|
|
|