1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-strict-prototypes %s
4 static int a16
[]; // expected-warning {{tentative array definition assumed to have one element}}
11 // PR10013: Scope of extern declarations extend past enclosing block
20 return PR10013_x
; // expected-error{{incompatible pointer to integer conversion}}
23 static int test1_a
[]; // expected-warning {{tentative array definition assumed to have one element}}
27 void test2declarer(void) { extern int test2_array
[100]; }
28 extern int test2_array
[];
29 int test2v
= sizeof(test2_array
); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int[]'}}
31 void test3declarer(void) {
32 { extern int test3_array
[100]; }
33 extern int test3_array
[];
34 int x
= sizeof(test3_array
); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int[]'}}
38 extern int test4_array
[];
40 extern int test4_array
[100];
41 int x
= sizeof(test4_array
); // fine
43 int x
= sizeof(test4_array
); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int[]'}}
46 // Test that invalid local extern declarations of library
47 // builtins behave reasonably.
48 extern void abort(void); // expected-note 2 {{previous declaration is here}}
49 extern float *calloc(void); // expected-warning {{incompatible redeclaration of library function}} expected-note {{is a builtin}} expected-note 2 {{previous declaration is here}}
51 int abort(void); // expected-error {{conflicting types}}
52 float *malloc(void); // expected-warning {{incompatible redeclaration of library function}} expected-note 2 {{is a builtin}}
53 int *calloc(void); // expected-error {{conflicting types}}
56 int abort(void); // expected-error {{conflicting types}}
57 float *malloc(void); // expected-warning {{incompatible redeclaration of library function}}
58 int *calloc(void); // expected-error {{conflicting types}}
61 void (*_abort
)(void) = &abort
;
62 void *(*_malloc
)() = &malloc
;
63 float *(*_calloc
)() = &calloc
;
67 extern int test6_array1
[100];
68 extern int test6_array2
[100];
72 // Types are only merged from visible declarations.
76 extern int test6_array1
[];
77 extern int test6_array2
[];
78 (void)sizeof(test6_array1
); // ok
79 (void)sizeof(test6_array2
); // expected-error {{incomplete type}}
83 test6_fn1(1.2); // expected-error {{passing 'double' to parameter of incompatible type 'int *'}}
84 // FIXME: This is valid, but we should warn on it.