diff options
author | ed <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
commit | f27e5a09a0d815b8a4814152954ff87dadfdefc0 (patch) | |
tree | ce7d964cbb5e39695b71481698f10cb099c23d4a /test/Sema/declspec.c | |
download | FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.zip FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.tar.gz |
Import Clang, at r72732.
Diffstat (limited to 'test/Sema/declspec.c')
-rw-r--r-- | test/Sema/declspec.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Sema/declspec.c b/test/Sema/declspec.c new file mode 100644 index 0000000..e325cc8 --- /dev/null +++ b/test/Sema/declspec.c @@ -0,0 +1,23 @@ +// RUN: clang-cc %s -verify -fsyntax-only +typedef char T[4]; + +T foo(int n, int m) { } // expected-error {{cannot return array or function}} + +void foof(const char *, ...) __attribute__((__format__(__printf__, 1, 2))), barf (void); + +int typedef validTypeDecl() { } // expected-error {{function definition declared 'typedef'}} + +struct _zend_module_entry { } +typedef struct _zend_function_entry { } // expected-error {{cannot combine with previous 'struct' declaration specifier}} +static void buggy(int *x) { } // expected-error {{function definition declared 'typedef'}} \ + // expected-error {{cannot combine with previous 'typedef' declaration specifier}} \ + // expected-error {{cannot combine with previous 'struct' declaration specifier}} + +// Type qualifiers. +typedef int f(void); +typedef f* fptr; +const f* v1; // expected-warning {{qualifier on function type 'f' (aka 'int (void)') has unspecified behavior}} +__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}} + |