• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 
3 struct foo; // expected-note 5 {{forward declaration of 'struct foo'}}
4 
5 void b;  // expected-error {{variable has incomplete type 'void'}}
6 struct foo f; // expected-error{{tentative definition has type 'struct foo' that is never completed}}
7 
8 static void c; // expected-error {{variable has incomplete type 'void'}}
9 static struct foo g;  // expected-warning {{tentative definition of variable with internal linkage has incomplete non-array type 'struct foo'}} \
10     expected-error{{tentative definition has type 'struct foo' that is never completed}}
11 
12 extern void d;
13 extern struct foo e;
14 
15 int ary[]; // expected-warning {{tentative array definition assumed to have one element}}
16 struct foo bary[]; // expected-error {{array has incomplete element type 'struct foo'}}
17 
func()18 void func() {
19   int ary[]; // expected-error{{definition of variable with array type needs an explicit size or an initializer}}
20   void b; // expected-error {{variable has incomplete type 'void'}}
21   struct foo f; // expected-error {{variable has incomplete type 'struct foo'}}
22 }
23 
24 int h[]; // expected-warning {{tentative array definition assumed to have one element}}
25 int (*i)[] = &h+1; // expected-error {{arithmetic on a pointer to an incomplete type 'int []'}}
26 
27 struct bar j = {1}; // expected-error {{variable has incomplete type 'struct bar'}} \
28     expected-note {{forward declaration of 'struct bar'}}
29 struct bar k;
30 struct bar { int a; };
31 
32