Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Steve Naroff | d3cd1e5 | 2008-01-18 00:39:39 +0000 | [diff] [blame] | 2 | |
Douglas Gregor | ec8b59f | 2009-07-20 18:46:59 +0000 | [diff] [blame] | 3 | struct foo; // expected-note 5 {{forward declaration of 'struct foo'}} |
Douglas Gregor | 4ec339f | 2009-01-19 19:26:10 +0000 | [diff] [blame] | 4 | |
Steve Naroff | d3cd1e5 | 2008-01-18 00:39:39 +0000 | [diff] [blame] | 5 | void b; // expected-error {{variable has incomplete type 'void'}} |
Douglas Gregor | 275a369 | 2009-03-10 23:43:53 +0000 | [diff] [blame] | 6 | struct foo f; // expected-error{{tentative definition has type 'struct foo' that is never completed}} |
Steve Naroff | d3cd1e5 | 2008-01-18 00:39:39 +0000 | [diff] [blame] | 7 | |
| 8 | static void c; // expected-error {{variable has incomplete type 'void'}} |
Douglas Gregor | ec8b59f | 2009-07-20 18:46:59 +0000 | [diff] [blame] | 9 | static 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 Naroff | d3cd1e5 | 2008-01-18 00:39:39 +0000 | [diff] [blame] | 11 | |
| 12 | extern void d; |
| 13 | extern struct foo e; |
| 14 | |
Daniel Dunbar | dbb4f21 | 2009-04-15 21:35:27 +0000 | [diff] [blame] | 15 | int ary[]; // expected-warning {{tentative array definition assumed to have one element}} |
Steve Naroff | 9a75f8a | 2008-01-18 20:40:52 +0000 | [diff] [blame] | 16 | struct foo bary[]; // expected-error {{array has incomplete element type 'struct foo'}} |
| 17 | |
Steve Naroff | d3cd1e5 | 2008-01-18 00:39:39 +0000 | [diff] [blame] | 18 | void func() { |
Steve Naroff | 9a75f8a | 2008-01-18 20:40:52 +0000 | [diff] [blame] | 19 | int ary[]; // expected-error{{variable has incomplete type 'int []'}} |
Steve Naroff | d3cd1e5 | 2008-01-18 00:39:39 +0000 | [diff] [blame] | 20 | void b; // expected-error {{variable has incomplete type 'void'}} |
| 21 | struct foo f; // expected-error {{variable has incomplete type 'struct foo'}} |
| 22 | } |
Chris Lattner | e60cff1 | 2008-07-03 03:53:40 +0000 | [diff] [blame] | 23 | |
Daniel Dunbar | dbb4f21 | 2009-04-15 21:35:27 +0000 | [diff] [blame] | 24 | int h[]; // expected-warning {{tentative array definition assumed to have one element}} |
Chris Lattner | e60cff1 | 2008-07-03 03:53:40 +0000 | [diff] [blame] | 25 | int (*i)[] = &h+1; // expected-error {{arithmetic on pointer to incomplete type 'int (*)[]'}} |
| 26 | |
Eli Friedman | a31feca | 2009-04-13 21:28:54 +0000 | [diff] [blame] | 27 | struct bar j = {1}; // expected-error {{variable has incomplete type 'struct bar'}} \ |
| 28 | expected-note {{forward declaration of 'struct bar'}} |
| 29 | struct bar k; |
| 30 | struct bar { int a; }; |
| 31 | |