2009-12-15 23:14:24 +03:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
2008-01-18 03:39:39 +03:00
|
|
|
|
2009-07-20 22:46:59 +04:00
|
|
|
struct foo; // expected-note 5 {{forward declaration of 'struct foo'}}
|
2009-01-19 22:26:10 +03:00
|
|
|
|
2008-01-18 03:39:39 +03:00
|
|
|
void b; // expected-error {{variable has incomplete type 'void'}}
|
2009-03-11 02:43:53 +03:00
|
|
|
struct foo f; // expected-error{{tentative definition has type 'struct foo' that is never completed}}
|
2008-01-18 03:39:39 +03:00
|
|
|
|
|
|
|
static void c; // expected-error {{variable has incomplete type 'void'}}
|
2009-07-20 22:46:59 +04:00
|
|
|
static struct foo g; // expected-warning {{tentative definition of variable with internal linkage has incomplete non-array type 'struct foo'}} \
|
|
|
|
expected-error{{tentative definition has type 'struct foo' that is never completed}}
|
2008-01-18 03:39:39 +03:00
|
|
|
|
|
|
|
extern void d;
|
|
|
|
extern struct foo e;
|
|
|
|
|
2009-04-16 01:35:27 +04:00
|
|
|
int ary[]; // expected-warning {{tentative array definition assumed to have one element}}
|
2008-01-18 23:40:52 +03:00
|
|
|
struct foo bary[]; // expected-error {{array has incomplete element type 'struct foo'}}
|
|
|
|
|
2008-01-18 03:39:39 +03:00
|
|
|
void func() {
|
2010-02-09 10:26:29 +03:00
|
|
|
int ary[]; // expected-error{{definition of variable with array type needs an explicit size or an initializer}}
|
2008-01-18 03:39:39 +03:00
|
|
|
void b; // expected-error {{variable has incomplete type 'void'}}
|
|
|
|
struct foo f; // expected-error {{variable has incomplete type 'struct foo'}}
|
|
|
|
}
|
2008-07-03 07:53:40 +04:00
|
|
|
|
2009-04-16 01:35:27 +04:00
|
|
|
int h[]; // expected-warning {{tentative array definition assumed to have one element}}
|
2011-06-27 12:02:19 +04:00
|
|
|
int (*i)[] = &h+1; // expected-error {{arithmetic on a pointer to an incomplete type 'int []'}}
|
2008-07-03 07:53:40 +04:00
|
|
|
|
2009-04-14 01:28:54 +04:00
|
|
|
struct bar j = {1}; // expected-error {{variable has incomplete type 'struct bar'}} \
|
|
|
|
expected-note {{forward declaration of 'struct bar'}}
|
|
|
|
struct bar k;
|
|
|
|
struct bar { int a; };
|
|
|
|
|