summaryrefslogtreecommitdiff
path: root/test/Sema/extern-redecl.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2013-06-10 20:45:12 +0000
committerDimitry Andric <dim@FreeBSD.org>2013-06-10 20:45:12 +0000
commit6a0372513edbc473b538d2f724efac50405d6fef (patch)
tree8f7776b7310bebaf415ac5b69e46e9f928c37144 /test/Sema/extern-redecl.c
parent809500fc2c13c8173a16b052304d983864e4a1e1 (diff)
downloadsrc-test2-6a0372513edbc473b538d2f724efac50405d6fef.tar.gz
src-test2-6a0372513edbc473b538d2f724efac50405d6fef.zip
Notes
Diffstat (limited to 'test/Sema/extern-redecl.c')
-rw-r--r--test/Sema/extern-redecl.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/Sema/extern-redecl.c b/test/Sema/extern-redecl.c
index 9a085de0c001..e9a4c571bd2d 100644
--- a/test/Sema/extern-redecl.c
+++ b/test/Sema/extern-redecl.c
@@ -33,3 +33,32 @@ void test3declarer() {
extern int test3_array[];
int x = sizeof(test3_array); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int []'}}
}
+
+void test4() {
+ extern int test4_array[];
+ {
+ extern int test4_array[100];
+ int x = sizeof(test4_array); // fine
+ }
+ int x = sizeof(test4_array); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int []'}}
+}
+
+// Test that invalid local extern declarations of library
+// builtins behave reasonably.
+extern void abort(void); // expected-note 2 {{previous declaration is here}}
+extern float *calloc(); // expected-warning {{incompatible redeclaration of library function}} expected-note {{is a builtin}} expected-note 2 {{previous declaration is here}}
+void test5a() {
+ int abort(); // expected-error {{conflicting types}}
+ float *malloc(); // expected-warning {{incompatible redeclaration of library function}} expected-note 2 {{is a builtin}}
+ int *calloc(); // expected-error {{conflicting types}}
+}
+void test5b() {
+ int abort(); // expected-error {{conflicting types}}
+ float *malloc(); // expected-warning {{incompatible redeclaration of library function}}
+ int *calloc(); // expected-error {{conflicting types}}
+}
+void test5c() {
+ void (*_abort)(void) = &abort;
+ void *(*_malloc)() = &malloc;
+ float *(*_calloc)() = &calloc;
+}