2009-03-24 10:24:46 +08:00
|
|
|
// RUN: clang-cc -emit-llvm %s -o %t
|
2007-10-27 00:31:40 +08:00
|
|
|
|
|
|
|
int A[10] = { 1,2,3,4,5 };
|
|
|
|
|
2007-12-02 15:09:19 +08:00
|
|
|
|
|
|
|
extern int x[];
|
|
|
|
void foo() { x[0] = 1; }
|
|
|
|
int x[10];
|
|
|
|
void bar() { x[0] = 1; }
|
|
|
|
|
2007-12-02 15:30:13 +08:00
|
|
|
|
2007-12-02 15:46:00 +08:00
|
|
|
extern int y[];
|
2007-12-11 03:50:32 +08:00
|
|
|
void *g = y;
|
2007-12-02 15:30:13 +08:00
|
|
|
|
2007-12-09 08:36:01 +08:00
|
|
|
int latin_ptr2len (char *p);
|
|
|
|
int (*mb_ptr2len) (char *p) = latin_ptr2len;
|
|
|
|
|
2007-12-10 07:49:42 +08:00
|
|
|
|
2007-12-11 09:38:45 +08:00
|
|
|
char string[8] = "string"; // extend init
|
|
|
|
char string2[4] = "string"; // truncate init
|
2007-12-10 07:49:42 +08:00
|
|
|
|
2007-12-18 16:16:44 +08:00
|
|
|
char *test(int c) {
|
|
|
|
static char buf[10];
|
|
|
|
static char *bufptr = buf;
|
|
|
|
|
|
|
|
return c ? buf : bufptr;
|
|
|
|
}
|
|
|
|
|
2008-01-10 02:47:25 +08:00
|
|
|
|
|
|
|
_Bool booltest = 0;
|
|
|
|
void booltest2() {
|
|
|
|
static _Bool booltest3 = 4;
|
|
|
|
}
|
|
|
|
|
2008-01-29 09:28:48 +08:00
|
|
|
// Scalars in braces.
|
|
|
|
static int a = { 1 };
|
|
|
|
|
2008-01-29 09:33:32 +08:00
|
|
|
// References to enums.
|
2008-01-29 09:28:48 +08:00
|
|
|
enum {
|
|
|
|
EnumA, EnumB
|
|
|
|
};
|
|
|
|
|
|
|
|
int c[] = { EnumA, EnumB };
|
2008-01-29 09:33:32 +08:00
|
|
|
|
|
|
|
// Binary operators
|
|
|
|
int d[] = { EnumA | EnumB };
|
2008-02-05 14:37:34 +08:00
|
|
|
|
|
|
|
// PR1968
|
|
|
|
static int array[];
|
|
|
|
static int array[4];
|
|
|
|
|