1 | // RUN: %clang_cc1 -emit-llvm %s -o %t |
2 | |
3 | int A[10] = { 1,2,3,4,5 }; |
4 | |
5 | |
6 | extern int x[]; |
7 | void foo() { x[0] = 1; } |
8 | int x[10]; |
9 | void bar() { x[0] = 1; } |
10 | |
11 | |
12 | extern int y[]; |
13 | void *g = y; |
14 | |
15 | int latin_ptr2len (char *p); |
16 | int (*mb_ptr2len) (char *p) = latin_ptr2len; |
17 | |
18 | |
19 | char string[8] = "string"; // extend init |
20 | char string2[4] = "string"; // truncate init |
21 | |
22 | char *test(int c) { |
23 | static char buf[10]; |
24 | static char *bufptr = buf; |
25 | |
26 | return c ? buf : bufptr; |
27 | } |
28 | |
29 | |
30 | _Bool booltest = 0; |
31 | void booltest2() { |
32 | static _Bool booltest3 = 4; |
33 | } |
34 | |
35 | // Scalars in braces. |
36 | static int a = { 1 }; |
37 | |
38 | // References to enums. |
39 | enum { |
40 | EnumA, EnumB |
41 | }; |
42 | |
43 | int c[] = { EnumA, EnumB }; |
44 | |
45 | // Binary operators |
46 | int d[] = { EnumA | EnumB }; |
47 | |
48 | // PR1968 |
49 | static int array[]; |
50 | static int array[4]; |
51 | |
52 | |