Fariborz Jahanian | 709296d | 2012-02-22 22:32:05 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp |
| 2 | // RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp |
| 3 | |
| 4 | @interface F { |
| 5 | int supervar; |
| 6 | } |
| 7 | @end |
| 8 | |
| 9 | @interface G : F { |
| 10 | @public |
| 11 | int ivar; |
| 12 | } |
| 13 | @end |
| 14 | |
| 15 | @implementation G |
| 16 | - (void)foo:(F *)arg { |
| 17 | int q = arg->supervar; |
| 18 | int v = ((G *)arg)->ivar; |
| 19 | } |
| 20 | @end |
| 21 | |
| 22 | void objc_assign_strongCast(id); |
| 23 | void __CFAssignWithWriteBarrier(void **location, void *value) { |
| 24 | objc_assign_strongCast((id)value); |
| 25 | } |
| 26 | |
| 27 | // radar 7607605 |
| 28 | @interface RealClass { |
| 29 | @public |
| 30 | int f; |
| 31 | } |
| 32 | @end |
| 33 | |
| 34 | @implementation RealClass |
| 35 | @end |
| 36 | |
| 37 | @interface Foo { |
| 38 | id reserved; |
| 39 | } |
| 40 | @end |
| 41 | |
| 42 | @implementation Foo |
| 43 | - (void)bar { |
| 44 | ((RealClass*)reserved)->f = 99; |
| 45 | } |
| 46 | @end |