blob: 0214a0c6ce4c9303685527823cd69ff5fef41950 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -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() {
Douglas Gregor60c93c92010-02-09 07:26:29 +000019 int ary[]; // expected-error{{definition of variable with array type needs an explicit size or an initializer}}
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}}
Chandler Carruth13b21be2011-06-27 08:02:19 +000025int (*i)[] = &h+1; // expected-error {{arithmetic on a pointer to an incomplete type 'int []'}}
Chris Lattnere60cff12008-07-03 03:53:40 +000026
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