2009-12-15 20:14:24 +00:00
|
|
|
// RUN: %clang_cc1 %s -verify -fsyntax-only
|
2007-12-19 05:31:29 +00:00
|
|
|
typedef char T[4];
|
|
|
|
|
2010-01-11 18:46:21 +00:00
|
|
|
T foo(int n, int m) { } // expected-error {{cannot return array type}}
|
2007-12-19 05:31:29 +00:00
|
|
|
|
2008-01-17 00:36:28 +00:00
|
|
|
void foof(const char *, ...) __attribute__((__format__(__printf__, 1, 2))), barf (void);
|
|
|
|
|
2022-02-04 15:19:56 -05:00
|
|
|
int typedef validTypeDecl(void) { } // expected-error {{function definition declared 'typedef'}}
|
2008-02-14 02:58:32 +00:00
|
|
|
|
2010-02-02 01:23:29 +00:00
|
|
|
struct _zend_module_entry { } // expected-error {{expected ';' after struct}}
|
2010-02-02 17:32:27 +00:00
|
|
|
int gv1;
|
2010-02-02 01:23:29 +00:00
|
|
|
typedef struct _zend_function_entry { } // expected-error {{expected ';' after struct}} \
|
2013-03-18 22:52:47 +00:00
|
|
|
// expected-warning {{typedef requires a name}}
|
2010-02-02 17:32:27 +00:00
|
|
|
int gv2;
|
|
|
|
|
2010-02-02 01:23:29 +00:00
|
|
|
static void buggy(int *x) { }
|
2008-02-14 02:58:32 +00:00
|
|
|
|
2008-04-02 06:50:17 +00:00
|
|
|
// Type qualifiers.
|
2024-11-08 11:25:39 -05:00
|
|
|
typedef int f(void);
|
2008-04-02 06:50:17 +00:00
|
|
|
typedef f* fptr;
|
2024-11-08 11:25:39 -05:00
|
|
|
const f* v1; // expected-warning {{'const' qualifier on function type 'f' (aka 'int (void)') has no effect and is a Clang extension}}
|
2009-02-19 23:45:49 +00:00
|
|
|
__restrict__ f* v2; // expected-error {{restrict requires a pointer or reference ('f' (aka 'int (void)') is invalid)}}
|
|
|
|
__restrict__ fptr v3; // expected-error {{pointer to function type 'f' (aka 'int (void)') may not be 'restrict' qualified}}
|
|
|
|
f *__restrict__ v4; // expected-error {{pointer to function type 'f' (aka 'int (void)') may not be 'restrict' qualified}}
|
2008-02-14 02:58:32 +00:00
|
|
|
|
2009-12-17 11:35:26 +00:00
|
|
|
restrict struct hallo; // expected-error {{restrict requires a pointer or reference}}
|
2010-02-02 01:23:29 +00:00
|
|
|
|
|
|
|
// PR6180
|
|
|
|
struct test1 {
|
|
|
|
} // expected-error {{expected ';' after struct}}
|
|
|
|
|
2022-02-04 15:19:56 -05:00
|
|
|
void test2(void) {}
|
2010-02-02 01:23:29 +00:00
|
|
|
|
2010-02-28 18:18:36 +00:00
|
|
|
|
|
|
|
// PR6423
|
|
|
|
struct test3s {
|
|
|
|
} // expected-error {{expected ';' after struct}}
|
|
|
|
typedef int test3g;
|
2013-11-13 06:57:53 +00:00
|
|
|
|
|
|
|
// PR8264
|
|
|
|
const const int pr8264_1 = 0; // expected-warning {{duplicate 'const' declaration specifier}}
|
|
|
|
volatile volatile int pr8264_2; // expected-warning {{duplicate 'volatile' declaration specifier}}
|
|
|
|
char * restrict restrict pr8264_3; // expected-warning {{duplicate 'restrict' declaration specifier}}
|
|
|
|
|
|
|
|
extern extern int pr8264_4; // expected-warning {{duplicate 'extern' declaration specifier}}
|
2022-02-04 15:19:56 -05:00
|
|
|
void pr8264_5(void) {
|
2013-11-13 06:57:53 +00:00
|
|
|
register register int x; // expected-warning {{duplicate 'register' declaration specifier}}
|
|
|
|
}
|
|
|
|
|
2022-02-04 15:19:56 -05:00
|
|
|
inline inline void pr8264_6(void) {} // expected-warning {{duplicate 'inline' declaration specifier}}
|
|
|
|
_Noreturn _Noreturn void pr8264_7(void); // expected-warning {{duplicate '_Noreturn' declaration specifier}}
|