1a5728872c7702ddd09537c95bc3cbd20e1f2fb09Daniel Dunbar// RUN: %clang_cc1 -fsyntax-only -verify %s 2d3cd1e56d19474ac785e54c3915d82d2ad7f7fa9Steve Naroff 3ec8b59ffc30c65051070e6d6cbb8e4b419210d18Douglas Gregorstruct foo; // expected-note 5 {{forward declaration of 'struct foo'}} 44ec339f43c0cae2678334850c90926bea10999c7Douglas Gregor 5d3cd1e56d19474ac785e54c3915d82d2ad7f7fa9Steve Naroffvoid b; // expected-error {{variable has incomplete type 'void'}} 6275a369f003f25bd22c00c1c0fc0251c7208caf4Douglas Gregorstruct foo f; // expected-error{{tentative definition has type 'struct foo' that is never completed}} 7d3cd1e56d19474ac785e54c3915d82d2ad7f7fa9Steve Naroff 8d3cd1e56d19474ac785e54c3915d82d2ad7f7fa9Steve Naroffstatic void c; // expected-error {{variable has incomplete type 'void'}} 9ec8b59ffc30c65051070e6d6cbb8e4b419210d18Douglas Gregorstatic struct foo g; // expected-warning {{tentative definition of variable with internal linkage has incomplete non-array type 'struct foo'}} \ 10ec8b59ffc30c65051070e6d6cbb8e4b419210d18Douglas Gregor expected-error{{tentative definition has type 'struct foo' that is never completed}} 11d3cd1e56d19474ac785e54c3915d82d2ad7f7fa9Steve Naroff 12d3cd1e56d19474ac785e54c3915d82d2ad7f7fa9Steve Naroffextern void d; 13d3cd1e56d19474ac785e54c3915d82d2ad7f7fa9Steve Naroffextern struct foo e; 14d3cd1e56d19474ac785e54c3915d82d2ad7f7fa9Steve Naroff 15dbb4f21125699f207ce7accfc52fdd99f47ce352Daniel Dunbarint ary[]; // expected-warning {{tentative array definition assumed to have one element}} 169a75f8ae17e7f917f491c2e8757bafbf57254c24Steve Naroffstruct foo bary[]; // expected-error {{array has incomplete element type 'struct foo'}} 179a75f8ae17e7f917f491c2e8757bafbf57254c24Steve Naroff 18d3cd1e56d19474ac785e54c3915d82d2ad7f7fa9Steve Naroffvoid func() { 1960c93c9981c467738369702e7aa23fd58c2b6aacDouglas Gregor int ary[]; // expected-error{{definition of variable with array type needs an explicit size or an initializer}} 20d3cd1e56d19474ac785e54c3915d82d2ad7f7fa9Steve Naroff void b; // expected-error {{variable has incomplete type 'void'}} 21d3cd1e56d19474ac785e54c3915d82d2ad7f7fa9Steve Naroff struct foo f; // expected-error {{variable has incomplete type 'struct foo'}} 22d3cd1e56d19474ac785e54c3915d82d2ad7f7fa9Steve Naroff} 23e60cff1089afa6368c57d716e4a295c5f1224e04Chris Lattner 24dbb4f21125699f207ce7accfc52fdd99f47ce352Daniel Dunbarint h[]; // expected-warning {{tentative array definition assumed to have one element}} 2513b21be065e9feb0759303bd51b8e8653130f0fbChandler Carruthint (*i)[] = &h+1; // expected-error {{arithmetic on a pointer to an incomplete type 'int []'}} 26e60cff1089afa6368c57d716e4a295c5f1224e04Chris Lattner 27a31fecaf63dc589af70bc1604f6d2aabeb7769f7Eli Friedmanstruct bar j = {1}; // expected-error {{variable has incomplete type 'struct bar'}} \ 28a31fecaf63dc589af70bc1604f6d2aabeb7769f7Eli Friedman expected-note {{forward declaration of 'struct bar'}} 29a31fecaf63dc589af70bc1604f6d2aabeb7769f7Eli Friedmanstruct bar k; 30a31fecaf63dc589af70bc1604f6d2aabeb7769f7Eli Friedmanstruct bar { int a; }; 31a31fecaf63dc589af70bc1604f6d2aabeb7769f7Eli Friedman 32