xref: /aosp_15_r20/external/clang/test/Sema/decl-invalid.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 %s -fsyntax-only -verify
2*67e74705SXin Li 
3*67e74705SXin Li // See Sema::ParsedFreeStandingDeclSpec about the double diagnostic
4*67e74705SXin Li typedef union <anonymous> __mbstate_t;  // expected-error {{declaration of anonymous union must be a definition}} expected-warning {{typedef requires a name}}
5*67e74705SXin Li 
6*67e74705SXin Li 
7*67e74705SXin Li // PR2017
8*67e74705SXin Li void x();
9*67e74705SXin Li int a() {
10*67e74705SXin Li   int r[x()];  // expected-error {{size of array has non-integer type 'void'}}
11*67e74705SXin Li 
12*67e74705SXin Li   static y ?; // expected-error{{unknown type name 'y'}} \
13*67e74705SXin Li                  expected-error{{expected identifier or '('}}
14*67e74705SXin Li }
15*67e74705SXin Li 
16*67e74705SXin Li int; // expected-warning {{declaration does not declare anything}}
17*67e74705SXin Li typedef int; // expected-warning {{typedef requires a name}}
18*67e74705SXin Li const int; // expected-warning {{declaration does not declare anything}}
19*67e74705SXin Li struct; // expected-error {{declaration of anonymous struct must be a definition}} // expected-warning {{declaration does not declare anything}}
20*67e74705SXin Li typedef int I;
21*67e74705SXin Li I; // expected-warning {{declaration does not declare anything}}
22*67e74705SXin Li 
23*67e74705SXin Li 
24*67e74705SXin Li 
25*67e74705SXin Li // rdar://6880449
26*67e74705SXin Li register int test1;     // expected-error {{illegal storage class on file-scoped variable}}
27*67e74705SXin Li 
28