blob: f6fed3c92d0d9f658ee8bcb8e0811b8abfef1b74 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 %s -fsyntax-only -verify
Chris Lattnere80a59c2007-07-25 00:24:17 +00002
Sebastian Redla4ed0d82008-12-28 15:28:59 +00003// See Sema::ParsedFreeStandingDeclSpec about the double diagnostic
Douglas Gregorcb821d02010-04-08 21:33:23 +00004typedef union <anonymous> __mbstate_t; // expected-error {{declaration of anonymous union must be a definition}} expected-warning {{declaration does not declare anything}}
Chris Lattnerfd89bc82008-04-02 01:05:10 +00005
6
7// PR2017
8void x();
9int a() {
Chris Lattner0947b4e2008-11-24 01:28:17 +000010 int r[x()]; // expected-error {{size of array has non-integer type 'void'}}
Chris Lattner51868722009-04-12 20:51:10 +000011
12 static y ?; // expected-error{{unknown type name 'y'}} \
John McCalld8ac0572009-11-03 19:26:08 +000013 expected-error{{expected identifier or '('}}
Chris Lattnerfd89bc82008-04-02 01:05:10 +000014}
15
Douglas Gregorcb821d02010-04-08 21:33:23 +000016int; // expected-warning {{declaration does not declare anything}}
17typedef int; // expected-warning {{declaration does not declare anything}}
18const int; // expected-warning {{declaration does not declare anything}}
19struct; // expected-error {{declaration of anonymous struct must be a definition}} // expected-warning {{declaration does not declare anything}}
Sebastian Redla4ed0d82008-12-28 15:28:59 +000020typedef int I;
Douglas Gregorcb821d02010-04-08 21:33:23 +000021I; // expected-warning {{declaration does not declare anything}}
Chris Lattnerd4b19d52009-05-12 21:44:00 +000022
23
24
25// rdar://6880449
26register int test1; // expected-error {{illegal storage class on file-scoped variable}}
27register int test2 __asm__("edi"); // expected-error {{global register variables are not supported}}
28