blob: 7354028cba392244b9b32cfbd6a20b7c6d5ebd33 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 %s -verify -fsyntax-only
Chris Lattnercd881292007-12-19 05:31:29 +00002typedef char T[4];
3
Douglas Gregor58408bc2010-01-11 18:46:21 +00004T foo(int n, int m) { } // expected-error {{cannot return array type}}
Chris Lattnercd881292007-12-19 05:31:29 +00005
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
Chris Lattner4ed5d912010-02-02 01:23:29 +000010struct _zend_module_entry { } // expected-error {{expected ';' after struct}}
Chris Lattner99c95202010-02-02 17:32:27 +000011int gv1;
Chris Lattner4ed5d912010-02-02 01:23:29 +000012typedef struct _zend_function_entry { } // expected-error {{expected ';' after struct}} \
Douglas Gregorcb821d02010-04-08 21:33:23 +000013 // expected-warning {{declaration does not declare anything}}
Chris Lattner99c95202010-02-02 17:32:27 +000014int gv2;
15
Chris Lattner4ed5d912010-02-02 01:23:29 +000016static void buggy(int *x) { }
Steve Naroffe39bfd02008-02-14 02:58:32 +000017
Chris Lattner96b77fc2008-04-02 06:50:17 +000018// Type qualifiers.
19typedef int f(void);
20typedef f* fptr;
Chris Lattnerd0344a42009-02-19 23:45:49 +000021const f* v1; // expected-warning {{qualifier on function type 'f' (aka 'int (void)') has unspecified behavior}}
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}}
24f *__restrict__ v4; // expected-error {{pointer to function type 'f' (aka 'int (void)') may not be 'restrict' qualified}}
Steve Naroffe39bfd02008-02-14 02:58:32 +000025
Nuno Lopes0a8bab02009-12-17 11:35:26 +000026restrict struct hallo; // expected-error {{restrict requires a pointer or reference}}
Chris Lattner4ed5d912010-02-02 01:23:29 +000027
28// PR6180
29struct test1 {
30} // expected-error {{expected ';' after struct}}
31
32void test2() {}
33
Chris Lattnerb3a4e432010-02-28 18:18:36 +000034
35// PR6423
36struct test3s {
37} // expected-error {{expected ';' after struct}}
38typedef int test3g;