• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 %s -fsyntax-only -verify
2 
3 // PR3310
4 struct a x1; // expected-note 2{{forward declaration of 'struct a'}}
5 static struct a x2; // expected-warning{{tentative definition of variable with internal linkage has incomplete non-array type 'struct a'}}
6 struct a x3[10]; // expected-error{{array has incomplete element type 'struct a'}}
7 struct a {int x;};
8 static struct a x2_okay;
9 struct a x3_okay[10];
10 struct b x4; // expected-error{{tentative definition has type 'struct b' that is never completed}} \
11             // expected-note{{forward declaration of 'struct b'}}
12 
13 const int a [1] = {1};
14 extern const int a[];
15 
16 extern const int b[];
17 const int b [1] = {1};
18 
19 extern const int c[] = {1}; // expected-warning{{'extern' variable has an initializer}}
20 const int c[];
21 
22 int i1 = 1; // expected-note {{previous definition is here}}
23 int i1 = 2; // expected-error {{redefinition of 'i1'}}
24 int i1;
25 int i1;
26 extern int i5; // expected-note {{previous definition is here}}
27 static int i5; // expected-error{{static declaration of 'i5' follows non-static declaration}}
28 
29 static int i2 = 5; // expected-note 1 {{previous definition is here}}
30 int i2 = 3; // expected-error{{non-static declaration of 'i2' follows static declaration}}
31 
32 static int i3 = 5;
33 extern int i3;
34 
35 __private_extern__ int pExtern;
36 int pExtern = 0;
37 
38 int i4;
39 int i4;
40 extern int i4;
41 
42 int (*pToArray)[];
43 int (*pToArray)[8];
44 
45 int redef[10];
46 int redef[];  // expected-note {{previous definition is here}}
47 int redef[11]; // expected-error{{redefinition of 'redef'}}
48 
func()49 void func() {
50   extern int i6; // expected-note {{previous definition is here}}
51   static int i6; // expected-error{{static declaration of 'i6' follows non-static declaration}}
52 }
53 
func2(void)54 void func2(void)
55 {
56   extern double *p;
57   extern double *p;
58 }
59 
60 // <rdar://problem/6808352>
61 static int a0[];
62 static int b0;
63 
64 static int a0[] = { 4 };
65 static int b0 = 5;
66