blob: 6a6ba753f3fe358137612d7482199df4f84262b8 [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 Gregorec8b59f2009-07-20 18:46:59 +00003struct foo; // expected-note 5 {{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'}}
Douglas Gregorec8b59f2009-07-20 18:46:59 +00009static 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}}
Steve Naroffd3cd1e52008-01-18 00:39:39 +000011
12extern void d;
13extern struct foo e;
14
Daniel Dunbardbb4f212009-04-15 21:35:27 +000015int ary[]; // expected-warning {{tentative array definition assumed to have one element}}
Steve Naroff9a75f8a2008-01-18 20:40:52 +000016struct foo bary[]; // expected-error {{array has incomplete element type 'struct foo'}}
17
Steve Naroffd3cd1e52008-01-18 00:39:39 +000018void func() {
Steve Naroff9a75f8a2008-01-18 20:40:52 +000019 int ary[]; // expected-error{{variable has incomplete type 'int []'}}
Steve Naroffd3cd1e52008-01-18 00:39:39 +000020 void b; // expected-error {{variable has incomplete type 'void'}}
21 struct foo f; // expected-error {{variable has incomplete type 'struct foo'}}
22}
Chris Lattnere60cff12008-07-03 03:53:40 +000023
Daniel Dunbardbb4f212009-04-15 21:35:27 +000024int h[]; // expected-warning {{tentative array definition assumed to have one element}}
Chris Lattnere60cff12008-07-03 03:53:40 +000025int (*i)[] = &h+1; // expected-error {{arithmetic on pointer to incomplete type 'int (*)[]'}}
26
Eli Friedmana31feca2009-04-13 21:28:54 +000027struct bar j = {1}; // expected-error {{variable has incomplete type 'struct bar'}} \
28 expected-note {{forward declaration of 'struct bar'}}
29struct bar k;
30struct bar { int a; };
31