diff options
author | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
commit | c72c57c9e9b69944e3e009cd5e209634839581d3 (patch) | |
tree | 4fc2f184c499d106f29a386c452b49e5197bf63d /test/Sema/merge-decls.c | |
parent | 5b20025c30d23d521e12c1f33ec8fa6b821952cd (diff) | |
download | FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.zip FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.tar.gz |
Vendor import of clang trunk r178860:
http://llvm.org/svn/llvm-project/cfe/trunk@178860
Diffstat (limited to 'test/Sema/merge-decls.c')
-rw-r--r-- | test/Sema/merge-decls.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/test/Sema/merge-decls.c b/test/Sema/merge-decls.c index 1a84d33..29707d2 100644 --- a/test/Sema/merge-decls.c +++ b/test/Sema/merge-decls.c @@ -37,3 +37,57 @@ void foo6096412(void) { int x = sizeof(i6096412); } + +typedef int test1_IA[]; +typedef int test1_A10[10]; +static test1_A10 *test1_f(void); +void test1_g(void) +{ + { + extern test1_IA *test1_f(void); + } + (void)sizeof(*test1_f()); +} + +typedef int test2_IA[]; +typedef int test2_A10[10]; + +static test2_A10 *test2_f(void); +static test2_IA *test2_f(void); + +void test2_g(void) +{ + (void)sizeof(*test2_f()); +} + +int (*test3_f())[10]; +int (*test3_f())[]; +int test3_k = sizeof(*test3_f()); + +void test4_f(int); +void test4_f(a) + char a; +{ + int v[sizeof(a) == 1 ? 1 : -1]; +} + +int test5_f(int (*)[10]); +int test5_f(int (*x)[]) { + return sizeof(*x); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int []'}} +} + +void test6_f(int (*a)[11]); +void test6_f(a) + int (*a)[]; +{} +void test6_g() { + int arr[10]; + test6_f(&arr); // expected-warning {{incompatible pointer types passing 'int (*)[10]' to parameter of type 'int (*)[11]}} +} + +void test7_f(int (*)[10]); +void test7_f(int (*)[]); // expected-note {{passing argument to parameter here}} +void test7_g() { + int x[5]; + test7_f(&x); // expected-warning {{incompatible pointer types passing 'int (*)[5]' to parameter of type 'int (*)[10]}} +} |