blob: 29621f1975e6bb0ad500a1838ab998463d68af64 [file] [log] [blame]
Chris Lattner388577b2007-08-25 05:26:51 +00001// RUN: clang -parse-noop %s
Reid Spencer5f016e22007-07-11 17:01:13 +00002
3void test1() {
4 if (sizeof (int){ 1}); // sizeof compound literal
5 if (sizeof (int)); // sizeof type
6
7 (int)4; // cast.
Chris Lattnere45fa6a2007-08-25 05:31:19 +00008 (int){4}; // compound literal.
Reid Spencer5f016e22007-07-11 17:01:13 +00009
10 // FIXME: change this to the struct version when we can.
11 //int A = (struct{ int a;}){ 1}.a;
12 int A = (int){ 1}.a;
13}
14
15int test2(int a, int b) {
16 return a ? a,b : a;
17}
18
19int test3(int a, int b, int c) {
20 return a = b = c;
21}
22
23int test4() {
24 test4();
25}
26
27int test_offsetof() {
28 // FIXME: change into something that is semantically correct.
29 __builtin_offsetof(int, a.b.c[4][5]);
30}
Chris Lattner4c1a2a92007-11-13 20:50:37 +000031
32void test_sizeof(){
33 int arr[10];
34 sizeof arr[0];
35 sizeof(arr[0]);
36 sizeof(arr)[0];
37}
38
Eli Friedmanadf077f2009-01-27 08:43:38 +000039// PR3418
40int test_leading_extension() {
41 __extension__ (*(char*)0) = 1;
42}
Chris Lattner4c1a2a92007-11-13 20:50:37 +000043