Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc %s -verify -fsyntax-only |
Chris Lattner | cd88129 | 2007-12-19 05:31:29 +0000 | [diff] [blame] | 2 | typedef char T[4]; |
| 3 | |
| 4 | T foo(int n, int m) { } // expected-error {{cannot return array or function}} |
| 5 | |
Steve Naroff | 1b4a622 | 2008-01-17 00:36:28 +0000 | [diff] [blame] | 6 | void foof(const char *, ...) __attribute__((__format__(__printf__, 1, 2))), barf (void); |
| 7 | |
Steve Naroff | e39bfd0 | 2008-02-14 02:58:32 +0000 | [diff] [blame] | 8 | int typedef validTypeDecl() { } // expected-error {{function definition declared 'typedef'}} |
| 9 | |
Steve Naroff | 9532414 | 2008-02-12 04:08:59 +0000 | [diff] [blame] | 10 | struct _zend_module_entry { } |
| 11 | typedef struct _zend_function_entry { } // expected-error {{cannot combine with previous 'struct' declaration specifier}} |
Steve Naroff | e39bfd0 | 2008-02-14 02:58:32 +0000 | [diff] [blame] | 12 | static 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 Lattner | 96b77fc | 2008-04-02 06:50:17 +0000 | [diff] [blame] | 16 | // Type qualifiers. |
| 17 | typedef int f(void); |
| 18 | typedef f* fptr; |
Chris Lattner | d0344a4 | 2009-02-19 23:45:49 +0000 | [diff] [blame] | 19 | const 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}} |
| 22 | f *__restrict__ v4; // expected-error {{pointer to function type 'f' (aka 'int (void)') may not be 'restrict' qualified}} |
Steve Naroff | e39bfd0 | 2008-02-14 02:58:32 +0000 | [diff] [blame] | 23 | |