[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / declspec.c
blobca3216bd2fafc462ced5b36e0dc8554d0669c345
1 // RUN: %clang_cc1 %s -verify -fsyntax-only
2 typedef char T[4];
4 T foo(int n, int m) { } // expected-error {{cannot return array type}}
6 void foof(const char *, ...) __attribute__((__format__(__printf__, 1, 2))), barf (void);
8 int typedef validTypeDecl(void) { } // expected-error {{function definition declared 'typedef'}}
10 struct _zend_module_entry { } // expected-error {{expected ';' after struct}}
11 int gv1;
12 typedef struct _zend_function_entry { } // expected-error {{expected ';' after struct}} \
13 // expected-warning {{typedef requires a name}}
14 int gv2;
16 static void buggy(int *x) { }
18 // Type qualifiers.
19 typedef int f(void);
20 typedef f* fptr;
21 const f* v1; // expected-warning {{'const' qualifier on function type 'f' (aka 'int (void)') has no effect and is a Clang extension}}
22 __restrict__ f* v2; // expected-error {{restrict requires a pointer or reference ('f' (aka 'int (void)') is invalid)}}
23 __restrict__ fptr v3; // expected-error {{pointer to function type 'f' (aka 'int (void)') may not be 'restrict' qualified}}
24 f *__restrict__ v4; // expected-error {{pointer to function type 'f' (aka 'int (void)') may not be 'restrict' qualified}}
26 restrict struct hallo; // expected-error {{restrict requires a pointer or reference}}
28 // PR6180
29 struct test1 {
30 } // expected-error {{expected ';' after struct}}
32 void test2(void) {}
35 // PR6423
36 struct test3s {
37 } // expected-error {{expected ';' after struct}}
38 typedef int test3g;
40 // PR8264
41 const const int pr8264_1 = 0; // expected-warning {{duplicate 'const' declaration specifier}}
42 volatile volatile int pr8264_2; // expected-warning {{duplicate 'volatile' declaration specifier}}
43 char * restrict restrict pr8264_3; // expected-warning {{duplicate 'restrict' declaration specifier}}
45 extern extern int pr8264_4; // expected-warning {{duplicate 'extern' declaration specifier}}
46 void pr8264_5(void) {
47 register register int x; // expected-warning {{duplicate 'register' declaration specifier}}
50 inline inline void pr8264_6(void) {} // expected-warning {{duplicate 'inline' declaration specifier}}
51 _Noreturn _Noreturn void pr8264_7(void); // expected-warning {{duplicate '_Noreturn' declaration specifier}}