Douglas Gregor | 8c70006 | 2009-04-13 21:20:57 +0000 | [diff] [blame] | 1 | // Test this without pch. |
Chris Lattner | b3dcc74 | 2009-04-18 18:45:36 +0000 | [diff] [blame^] | 2 | // RUN: clang-cc -include %S/struct.h -fsyntax-only -verify %s && |
Douglas Gregor | 8c70006 | 2009-04-13 21:20:57 +0000 | [diff] [blame] | 3 | |
| 4 | // Test with pch. |
| 5 | // RUN: clang-cc -emit-pch -o %t %S/struct.h && |
| 6 | // RUN: clang-cc -include-pch %t -fsyntax-only -verify %s |
| 7 | |
| 8 | struct Point *p1; |
| 9 | |
| 10 | float getX(struct Point *p1) { |
| 11 | return p1->x; |
| 12 | } |
| 13 | |
| 14 | void *get_fun_ptr() { |
| 15 | return fun->is_ptr? fun->ptr : 0; |
| 16 | } |
| 17 | |
| 18 | struct Fun2 { |
| 19 | int very_fun; |
| 20 | }; |
| 21 | |
| 22 | int get_very_fun() { |
| 23 | return fun2->very_fun; |
| 24 | } |
Douglas Gregor | 2417ef7 | 2009-04-14 17:10:28 +0000 | [diff] [blame] | 25 | |
Douglas Gregor | 0b74891 | 2009-04-14 21:18:50 +0000 | [diff] [blame] | 26 | int *int_ptr_fail = &fun->is_ptr; // expected-error{{address of bit-field requested}} |
| 27 | |
Douglas Gregor | 2417ef7 | 2009-04-14 17:10:28 +0000 | [diff] [blame] | 28 | /* FIXME: DeclContexts aren't yet able to find "struct Nested" nested |
| 29 | within "struct S", so causing the following to fail. When not using |
| 30 | PCH, this works because Sema puts the nested struct onto the |
| 31 | declaration chain for its identifier, where C/Objective-C always |
| 32 | look. To fix the problem, we either need to give DeclContexts a way |
| 33 | to keep track of declarations that are visible without having to |
| 34 | build a full lookup table, or we need PCH files to read the |
| 35 | declaration chains. */ |
| 36 | /* struct Nested nested = { 1, 2 }; */ |