blob: 5b1196016032ba5a763b6197699a653c4ae1d736 [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 %s -verify -fsyntax-only
Chris Lattnerea72f442007-12-19 05:31:29 +00002typedef char T[4];
3
Douglas Gregorbb917672010-01-11 18:46:21 +00004T foo(int n, int m) { } // expected-error {{cannot return array type}}
Chris Lattnerea72f442007-12-19 05:31:29 +00005
Steve Naroff1aa19412008-01-17 00:36:28 +00006void foof(const char *, ...) __attribute__((__format__(__printf__, 1, 2))), barf (void);
7
Steve Narofff6319972008-02-14 02:58:32 +00008int typedef validTypeDecl() { } // expected-error {{function definition declared 'typedef'}}
9
Steve Naroffab468cb2008-02-12 04:08:59 +000010struct _zend_module_entry { }
11typedef struct _zend_function_entry { } // expected-error {{cannot combine with previous 'struct' declaration specifier}}
Steve Narofff6319972008-02-14 02:58:32 +000012static void buggy(int *x) { } // expected-error {{function definition declared 'typedef'}} \
13 // expected-error {{cannot combine with previous 'typedef' declaration specifier}} \
14 // expected-error {{cannot combine with previous 'struct' declaration specifier}}
15
Chris Lattnerdaaa8ba2008-04-02 06:50:17 +000016// Type qualifiers.
17typedef int f(void);
18typedef f* fptr;
Chris Lattner810d3302009-02-19 23:45:49 +000019const f* v1; // expected-warning {{qualifier on function type 'f' (aka 'int (void)') has unspecified behavior}}
20__restrict__ f* v2; // expected-error {{restrict requires a pointer or reference ('f' (aka 'int (void)') is invalid)}}
21__restrict__ fptr v3; // expected-error {{pointer to function type 'f' (aka 'int (void)') may not be 'restrict' qualified}}
22f *__restrict__ v4; // expected-error {{pointer to function type 'f' (aka 'int (void)') may not be 'restrict' qualified}}
Steve Narofff6319972008-02-14 02:58:32 +000023
Nuno Lopese9823fa2009-12-17 11:35:26 +000024restrict struct hallo; // expected-error {{restrict requires a pointer or reference}}