1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-strict-prototypes %s
3 static int a16
[]; // expected-warning {{tentative array definition assumed to have one element}}
10 // PR10013: Scope of extern declarations extend past enclosing block
19 return PR10013_x
; // expected-error{{incompatible pointer to integer conversion}}
22 static int test1_a
[]; // expected-warning {{tentative array definition assumed to have one element}}
25 void test2declarer(void) { extern int test2_array
[100]; }
26 extern int test2_array
[];
27 int test2v
= sizeof(test2_array
); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int[]'}}
29 void test3declarer(void) {
30 { extern int test3_array
[100]; }
31 extern int test3_array
[];
32 int x
= sizeof(test3_array
); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int[]'}}
36 extern int test4_array
[];
38 extern int test4_array
[100];
39 int x
= sizeof(test4_array
); // fine
41 int x
= sizeof(test4_array
); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int[]'}}
44 // Test that invalid local extern declarations of library
45 // builtins behave reasonably.
46 extern void abort(void); // expected-note 2 {{previous declaration is here}}
47 extern float *calloc(void); // expected-warning {{incompatible redeclaration of library function}} expected-note {{is a builtin}} expected-note 2 {{previous declaration is here}}
49 int abort(void); // expected-error {{conflicting types}}
50 float *malloc(void); // expected-warning {{incompatible redeclaration of library function}} expected-note 2 {{is a builtin}}
51 int *calloc(void); // expected-error {{conflicting types}}
54 int abort(void); // expected-error {{conflicting types}}
55 float *malloc(void); // expected-warning {{incompatible redeclaration of library function}}
56 int *calloc(void); // expected-error {{conflicting types}}
59 void (*_abort
)(void) = &abort
;
60 void *(*_malloc
)() = &malloc
;
61 float *(*_calloc
)() = &calloc
;
65 extern int test6_array1
[100];
66 extern int test6_array2
[100];
70 // Types are only merged from visible declarations.
74 extern int test6_array1
[];
75 extern int test6_array2
[];
76 (void)sizeof(test6_array1
); // ok
77 (void)sizeof(test6_array2
); // expected-error {{incomplete type}}
81 test6_fn1(1.2); // expected-error {{passing 'double' to parameter of incompatible type 'int *'}}
82 // FIXME: This is valid, but we should warn on it.