1// RUN: %clang_cc1 -fsyntax-only -verify %s 2 3void test1() { 4 if (sizeof (int){ 1}) {} // sizeof compound literal 5 if (sizeof (int)) {} // sizeof type 6 7 (void)(int)4; // cast. 8 (void)(int){4}; // compound literal. 9 10 int A = (struct{ int a;}){ 1}.a; 11} 12 13int test2(int a, int b) { 14 return a ? (void)a,b : a; 15} 16 17int test3(int a, int b, int c) { 18 return a = b = c; 19} 20 21int test4() { 22 test4(); 23 return 0; 24} 25 26struct X0 { struct { struct { int c[10][9]; } b; } a; }; 27 28int test_offsetof() { 29 (void)__builtin_offsetof(struct X0, a.b.c[4][5]); 30 return 0; 31} 32 33void test_sizeof(){ 34 int arr[10]; 35 (void)sizeof arr[0]; 36 (void)sizeof(arr[0]); 37 (void)sizeof(arr)[0]; 38} 39 40// PR3418 41int test_leading_extension() { 42 __extension__ (*(char*)0) = 1; // expected-warning {{indirection of non-volatile null pointer}} \ 43 // expected-note {{consider using __builtin_trap}} 44 return 0; 45} 46 47// PR3972 48int test5(int); 49int test6(void) { 50 return test5( // expected-note {{to match}} 51 test5(1) 52 ; // expected-error {{expected ')'}} 53} 54 55// PR8394 56void test7() { 57 ({} // expected-note {{to match}} 58 ; // expected-error {{expected ')'}} 59} 60 61// PR16992 62struct pr16992 { int x; }; 63 64void func_16992 () { 65 int x1 = sizeof int; // expected-error {{expected parentheses around type name in sizeof expression}} 66 int x2 = sizeof struct pr16992; // expected-error {{expected parentheses around type name in sizeof expression}} 67 int x3 = __alignof int; // expected-error {{expected parentheses around type name in __alignof expression}} 68 int x4 = _Alignof int; // expected-error {{expected parentheses around type name in _Alignof expression}} 69} 70 71void callee(double, double); 72void test8() { 73 callee(foobar, // expected-error {{use of undeclared identifier 'foobar'}} 74 fizbin); // expected-error {{use of undeclared identifier 'fizbin'}} 75} 76