blob: 44ebe661befd8a57672e53c1b4562309e25d74ef [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -parse-noop -verify %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
Chris Lattner1721a2d2009-04-13 00:10:38 +000044// PR3972
45int test5(int);
46int test6(void) {
47 return test5( // expected-note {{to match}}
48 test5(1)
49 ; // expected-error {{expected ')'}}
50}