blob: 7953a69fed001a92da6a54dca2c34e9a41a33158 [file] [log] [blame]
Daniel Dunbar3573b2c2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Steve Naroff7cbb1462007-07-31 12:34:36 +00002
3typedef int TInt;
4
5static void test() {
6 int *pi;
7
Steve Naroff11b649c2007-08-01 17:20:42 +00008 int typeof (int) aIntInt; // expected-error{{cannot combine with previous 'int' declaration specifier}}
9 short typeof (int) aShortInt; // expected-error{{'short typeof' is invalid}}
Steve Naroff4c255ab2007-07-31 23:56:32 +000010 int int ttt; // expected-error{{cannot combine with previous 'int' declaration specifier}}
Steve Naroff11b649c2007-08-01 17:20:42 +000011 typeof(TInt) anInt;
Chris Lattner2c41d482009-03-29 17:18:04 +000012 short TInt eee; // expected-error{{expected ';' at end of declaration}}
13 void ary[7] fff; // expected-error{{array has incomplete element type 'void'}} expected-error{{expected ';' at end of declaration}}
Argiris Kirtzidis53f05482009-05-22 10:22:18 +000014 typeof(void ary[7]) anIntError; // expected-error{{expected ')'}} expected-note {{to match this '('}} expected-error {{variable has incomplete type 'typeof(void)' (aka 'void')}}
Steve Naroff11b649c2007-08-01 17:20:42 +000015 typeof(const int) aci;
16 const typeof (*pi) aConstInt;
Steve Naroff7cbb1462007-07-31 12:34:36 +000017 int xx;
Steve Naroff7cbb1462007-07-31 12:34:36 +000018 int *i;
Steve Naroff7cbb1462007-07-31 12:34:36 +000019}
Douglas Gregor73aa14d2010-07-28 18:22:12 +000020
21// <rdar://problem/8237491>
22void test2() {
23 int a;
24 short b;
25 __typeof__(a) (*f)(__typeof__(b));
26}