declspec.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // RUN: %clang_cc1 %s -verify -fsyntax-only
  2. typedef char T[4];
  3. T foo(int n, int m) { } // expected-error {{cannot return array type}}
  4. void foof(const char *, ...) __attribute__((__format__(__printf__, 1, 2))), barf (void);
  5. int typedef validTypeDecl() { } // expected-error {{function definition declared 'typedef'}}
  6. struct _zend_module_entry { } // expected-error {{expected ';' after struct}}
  7. int gv1;
  8. typedef struct _zend_function_entry { } // expected-error {{expected ';' after struct}} \
  9. // expected-warning {{typedef requires a name}}
  10. int gv2;
  11. static void buggy(int *x) { }
  12. // Type qualifiers.
  13. typedef int f(void);
  14. typedef f* fptr;
  15. const f* v1; // expected-warning {{qualifier on function type 'f' (aka 'int (void)') has unspecified behavior}}
  16. __restrict__ f* v2; // expected-error {{restrict requires a pointer or reference ('f' (aka 'int (void)') is invalid)}}
  17. __restrict__ fptr v3; // expected-error {{pointer to function type 'f' (aka 'int (void)') may not be 'restrict' qualified}}
  18. f *__restrict__ v4; // expected-error {{pointer to function type 'f' (aka 'int (void)') may not be 'restrict' qualified}}
  19. restrict struct hallo; // expected-error {{restrict requires a pointer or reference}}
  20. // PR6180
  21. struct test1 {
  22. } // expected-error {{expected ';' after struct}}
  23. void test2() {}
  24. // PR6423
  25. struct test3s {
  26. } // expected-error {{expected ';' after struct}}
  27. typedef int test3g;
  28. // PR8264
  29. const const int pr8264_1 = 0; // expected-warning {{duplicate 'const' declaration specifier}}
  30. volatile volatile int pr8264_2; // expected-warning {{duplicate 'volatile' declaration specifier}}
  31. char * restrict restrict pr8264_3; // expected-warning {{duplicate 'restrict' declaration specifier}}
  32. extern extern int pr8264_4; // expected-warning {{duplicate 'extern' declaration specifier}}
  33. void pr8264_5() {
  34. register register int x; // expected-warning {{duplicate 'register' declaration specifier}}
  35. }
  36. inline inline void pr8264_6() {} // expected-warning {{duplicate 'inline' declaration specifier}}
  37. _Noreturn _Noreturn void pr8264_7(); // expected-warning {{duplicate '_Noreturn' declaration specifier}}