blob: eb93e8e380310d38cbe0a1d33676a4c7e5e6afa2 [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -fsyntax-only -verify %s
Steve Naroffd3cd1e52008-01-18 00:39:39 +00002
Douglas Gregor275a3692009-03-10 23:43:53 +00003struct foo; // expected-note 4 {{forward declaration of 'struct foo'}}
Douglas Gregor4ec339f2009-01-19 19:26:10 +00004
Steve Naroffd3cd1e52008-01-18 00:39:39 +00005void b; // expected-error {{variable has incomplete type 'void'}}
Douglas Gregor275a3692009-03-10 23:43:53 +00006struct foo f; // expected-error{{tentative definition has type 'struct foo' that is never completed}}
Steve Naroffd3cd1e52008-01-18 00:39:39 +00007
8static void c; // expected-error {{variable has incomplete type 'void'}}
9static struct foo g; // expected-error {{variable has incomplete type 'struct foo'}}
10
11extern void d;
12extern struct foo e;
13
Daniel Dunbardbb4f212009-04-15 21:35:27 +000014int ary[]; // expected-warning {{tentative array definition assumed to have one element}}
Steve Naroff9a75f8a2008-01-18 20:40:52 +000015struct foo bary[]; // expected-error {{array has incomplete element type 'struct foo'}}
16
Steve Naroffd3cd1e52008-01-18 00:39:39 +000017void func() {
Steve Naroff9a75f8a2008-01-18 20:40:52 +000018 int ary[]; // expected-error{{variable has incomplete type 'int []'}}
Steve Naroffd3cd1e52008-01-18 00:39:39 +000019 void b; // expected-error {{variable has incomplete type 'void'}}
20 struct foo f; // expected-error {{variable has incomplete type 'struct foo'}}
21}
Chris Lattnere60cff12008-07-03 03:53:40 +000022
Daniel Dunbardbb4f212009-04-15 21:35:27 +000023int h[]; // expected-warning {{tentative array definition assumed to have one element}}
Chris Lattnere60cff12008-07-03 03:53:40 +000024int (*i)[] = &h+1; // expected-error {{arithmetic on pointer to incomplete type 'int (*)[]'}}
25
Eli Friedmana31feca2009-04-13 21:28:54 +000026struct bar j = {1}; // expected-error {{variable has incomplete type 'struct bar'}} \
27 expected-note {{forward declaration of 'struct bar'}}
28struct bar k;
29struct bar { int a; };
30