blob: 8556687123c52f5e48606ff5c38810d7e4231b06 [file] [log] [blame]
Steve Naroff7cbb1462007-07-31 12:34:36 +00001// RUN: clang -parse-ast-check %s -pedantic
2
3typedef int TInt;
4
5static void test() {
6 int *pi;
7
Steve Naroff4c255ab2007-07-31 23:56:32 +00008 int typeof (int) aIntInt; // expected-error{{cannot combine with previous 'int' declaration specifier}} expected-warning{{extension used}}
9 short typeof (int) aShortInt; // expected-error{{'short typeof' is invalid}} expected-warning{{extension used}}
10 int int ttt; // expected-error{{cannot combine with previous 'int' declaration specifier}}
Steve Naroff7cbb1462007-07-31 12:34:36 +000011 typeof(TInt) anInt; // expected-warning{{extension used}}
Steve Naroff4c255ab2007-07-31 23:56:32 +000012 short TInt eee; // expected-error{{parse error}}
13 void ary[7] fff; // expected-error{{array has incomplete element type 'void'}} expected-error{{parse error}}
14 typeof(void ary[7]) anIntError; // expected-warning{{extension used}} expected-error{{expected ')'}} expected-error{{to match this '('}}
Steve Naroff7cbb1462007-07-31 12:34:36 +000015 typeof(const int) aci; // expected-warning{{extension used}}
16 const typeof (*pi) aConstInt; // expected-warning{{extension used}}
17 int xx;
Steve Naroff7cbb1462007-07-31 12:34:36 +000018 int *i;
19 i = aci; // expected-warning{{incompatible types assigning 'typeof(int const)' to 'int *'}}
20 i = anInt; // expected-warning{{incompatible types assigning 'typeof(TInt)' to 'int *'}}
21 i = aConstInt; // expected-warning{{incompatible types assigning 'typeof(<expr>) const' to 'int *'}}
22 i = xx; // expected-warning{{incompatible types assigning 'int' to 'int *'}}
23}