Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o %t |
Daniel Dunbar | e4c9238 | 2009-02-13 22:58:39 +0000 | [diff] [blame] | 2 | |
Lauro Ramos Venancio | 305762c | 2008-02-18 22:44:02 +0000 | [diff] [blame] | 3 | void f1() { |
| 4 | // Scalars in braces. |
| 5 | int a = { 1 }; |
Lauro Ramos Venancio | 305762c | 2008-02-18 22:44:02 +0000 | [diff] [blame] | 6 | } |
| 7 | |
| 8 | void f2() { |
| 9 | int a[2][2] = { { 1, 2 }, { 3, 4 } }; |
| 10 | int b[3][3] = { { 1, 2 }, { 3, 4 } }; |
| 11 | int *c[2] = { &a[1][1], &b[2][2] }; |
| 12 | int *d[2][2] = { {&a[1][1], &b[2][2]}, {&a[0][0], &b[1][1]} }; |
| 13 | int *e[3][3] = { {&a[1][1], &b[2][2]}, {&a[0][0], &b[1][1]} }; |
Lauro Ramos Venancio | 145cd89 | 2008-02-19 19:27:31 +0000 | [diff] [blame] | 14 | char ext[3][3] = {".Y",".U",".V"}; |
Anders Carlsson | a3881fc | 2008-01-29 01:28:48 +0000 | [diff] [blame] | 15 | } |
Chris Lattner | d3c3856 | 2008-05-04 00:56:25 +0000 | [diff] [blame] | 16 | |
| 17 | typedef void (* F)(void); |
| 18 | extern void foo(void); |
| 19 | struct S { F f; }; |
| 20 | void f3() { |
| 21 | struct S a[1] = { { foo } }; |
| 22 | } |
| 23 | |
Daniel Dunbar | e4c9238 | 2009-02-13 22:58:39 +0000 | [diff] [blame] | 24 | // Constants |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 25 | // RUN: grep '@g3 = constant i32 10' %t |
Daniel Dunbar | e4c9238 | 2009-02-13 22:58:39 +0000 | [diff] [blame] | 26 | // RUN: grep '@f4.g4 = internal constant i32 12' %t |
| 27 | const int g3 = 10; |
| 28 | int f4() { |
| 29 | static const int g4 = 12; |
| 30 | return g4; |
| 31 | } |