extern-redecl.c revision 927b0af2f0834bad37e3d2a1953804b0845d8711
1// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3// rdar: // 8125274
4static int a16[];  // expected-warning {{tentative array definition assumed to have one element}}
5
6void f16(void) {
7    extern int a16[];
8}
9
10
11// PR10013: Scope of extern declarations extend past enclosing block
12extern int PR10013_x;
13int PR10013(void) {
14  int *PR10013_x = 0;
15  {
16    extern int PR10013_x;
17    extern int PR10013_x;
18  }
19
20  return PR10013_x; // expected-warning{{incompatible pointer to integer conversion}}
21}
22
23static int test1_a[]; // expected-warning {{tentative array definition assumed to have one element}}
24extern int test1_a[];
25
26// rdar://13535367
27void test2declarer() { extern int test2_array[100]; }
28extern int test2_array[];
29int test2v = sizeof(test2_array); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int []'}}
30
31void test3declarer() {
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 []'}}
35}
36
37void test4() {
38  extern int test4_array[];
39  {
40    extern int test4_array[100];
41    int x = sizeof(test4_array); // fine
42  }
43  int x = sizeof(test4_array); // expected-error {{invalid application of 'sizeof' to an incomplete type 'int []'}}
44}
45