Chris Lattner | ca79092 | 2009-04-21 19:55:16 +0000 | [diff] [blame^] | 1 | // RUN: clang-cc -triple x86_64-apple-darwin9 -verify -fsyntax-only %s |
Daniel Dunbar | ff89666 | 2009-04-21 15:48:54 +0000 | [diff] [blame] | 2 | |
| 3 | @class I0; |
Chris Lattner | ca79092 | 2009-04-21 19:55:16 +0000 | [diff] [blame^] | 4 | |
| 5 | // rdar://6811884 |
| 6 | int g0 = sizeof(I0); // expected-error{{invalid application of 'sizeof' to a forward declared interface 'I0'}} |
Daniel Dunbar | ff89666 | 2009-04-21 15:48:54 +0000 | [diff] [blame] | 7 | |
| 8 | @interface I0 { |
| 9 | char x[4]; |
| 10 | } |
| 11 | |
| 12 | @property int p0; |
| 13 | @end |
| 14 | |
| 15 | // size == 4 |
Chris Lattner | ca79092 | 2009-04-21 19:55:16 +0000 | [diff] [blame^] | 16 | int g1[ sizeof(I0) // expected-error {{invalid application of 'sizeof' to interface 'I0' in non-fragile ABI}} |
| 17 | == 4 ? 1 : -1]; |
Daniel Dunbar | ff89666 | 2009-04-21 15:48:54 +0000 | [diff] [blame] | 18 | |
| 19 | @implementation I0 |
| 20 | @synthesize p0 = _p0; |
| 21 | @end |
| 22 | |
| 23 | // size == 4 (we do not include extended properties in the |
| 24 | // sizeof). |
Chris Lattner | ca79092 | 2009-04-21 19:55:16 +0000 | [diff] [blame^] | 25 | int g2[ sizeof(I0) // expected-error {{invalid application of 'sizeof' to interface 'I0' in non-fragile ABI}} |
| 26 | == 4 ? 1 : -1]; |
Daniel Dunbar | ff89666 | 2009-04-21 15:48:54 +0000 | [diff] [blame] | 27 | |
| 28 | @interface I1 |
| 29 | @property int p0; |
| 30 | @end |
| 31 | |
| 32 | @implementation I1 |
| 33 | @synthesize p0 = _p0; |
| 34 | @end |
| 35 | |
| 36 | // FIXME: This is currently broken due to the way the record layout we |
| 37 | // create is tied to whether we have seen synthesized properties. Ugh. |
| 38 | // int g3[ sizeof(I1) == 0 ? 1 : -1]; |