blob: 1e84d6523e7412a831e21cbf4bb00336ee8ba960 [file] [log] [blame]
Chris Lattnercd881292007-12-19 05:31:29 +00001// RUN: clang %s -verify -fsyntax-only
2typedef char T[4];
3
4T foo(int n, int m) { } // expected-error {{cannot return array or function}}
5
Steve Naroff1b4a6222008-01-17 00:36:28 +00006void foof(const char *, ...) __attribute__((__format__(__printf__, 1, 2))), barf (void);
7
Steve Naroffe39bfd02008-02-14 02:58:32 +00008int typedef validTypeDecl() { } // expected-error {{function definition declared 'typedef'}}
9
Steve Naroff95324142008-02-12 04:08:59 +000010struct _zend_module_entry { }
11typedef struct _zend_function_entry { } // expected-error {{cannot combine with previous 'struct' declaration specifier}}
Steve Naroffe39bfd02008-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 Lattner96b77fc2008-04-02 06:50:17 +000016// Type qualifiers.
17typedef int f(void);
18typedef f* fptr;
19const f* v1; // expected-warning {{qualifier on function type 'f' has unspecified behavior}}
20__restrict__ f* v2; // expected-error {{restrict requires a pointer or reference ('f' is invalid)}}
Chris Lattner26b76612008-04-02 17:15:17 +000021__restrict__ fptr v3; // expected-error {{pointer to function type ('f') may not be 'restrict' qualified}}
22f *__restrict__ v4; // expected-error {{pointer to function type ('f') may not be 'restrict' qualified}}
Steve Naroffe39bfd02008-02-14 02:58:32 +000023