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