Nuno Lopes | f231998 | 2009-02-02 15:00:55 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s |
Nuno Lopes | f231998 | 2009-02-02 15:00:55 +0000 | [diff] [blame] | 2 | // PR3459 |
| 3 | struct bar { |
| 4 | char n[1]; |
| 5 | }; |
| 6 | |
| 7 | struct foo { |
| 8 | char name[(int)&((struct bar *)0)->n]; |
Nuno Lopes | 1dfa6e1 | 2009-02-02 22:32:08 +0000 | [diff] [blame] | 9 | char name2[(int)&((struct bar *)0)->n - 1]; //expected-error{{fields must have a constant size}} |
Nuno Lopes | f231998 | 2009-02-02 15:00:55 +0000 | [diff] [blame] | 10 | }; |
Douglas Gregor | 1931b44 | 2009-02-03 00:34:39 +0000 | [diff] [blame^] | 11 | |
| 12 | // PR3430 |
| 13 | struct s { |
| 14 | struct st { |
| 15 | int v; |
| 16 | } *ts; |
| 17 | }; |
| 18 | |
| 19 | struct st; |
| 20 | |
| 21 | int foo() { |
| 22 | struct st *f; |
| 23 | return f->v + f[0].v; |
| 24 | } |