decl-invalid.c 1.0 KB

123456789101112131415161718192021222324252627
  1. // RUN: %clang_cc1 %s -fsyntax-only -verify
  2. // See Sema::ParsedFreeStandingDeclSpec about the double diagnostic
  3. typedef union <anonymous> __mbstate_t; // expected-error {{declaration of anonymous union must be a definition}} expected-warning {{typedef requires a name}}
  4. // PR2017
  5. void x();
  6. int a() {
  7. int r[x()]; // expected-error {{size of array has non-integer type 'void'}}
  8. static y ?; // expected-error{{unknown type name 'y'}} \
  9. expected-error{{expected identifier or '('}}
  10. }
  11. int; // expected-warning {{declaration does not declare anything}}
  12. typedef int; // expected-warning {{typedef requires a name}}
  13. const int; // expected-warning {{declaration does not declare anything}}
  14. struct; // expected-error {{declaration of anonymous struct must be a definition}} // expected-warning {{declaration does not declare anything}}
  15. typedef int I;
  16. I; // expected-warning {{declaration does not declare anything}}
  17. // rdar://6880449
  18. register int test1; // expected-error {{illegal storage class on file-scoped variable}}