1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp 2*f4a2713aSLionel Sambuc// 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*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc@interface F { 5*f4a2713aSLionel Sambuc int supervar; 6*f4a2713aSLionel Sambuc} 7*f4a2713aSLionel Sambuc@end 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambuc@interface G : F { 10*f4a2713aSLionel Sambuc@public 11*f4a2713aSLionel Sambuc int ivar; 12*f4a2713aSLionel Sambuc} 13*f4a2713aSLionel Sambuc@end 14*f4a2713aSLionel Sambuc 15*f4a2713aSLionel Sambuc@implementation G 16*f4a2713aSLionel Sambuc- (void)foo:(F *)arg { 17*f4a2713aSLionel Sambuc int q = arg->supervar; 18*f4a2713aSLionel Sambuc int v = ((G *)arg)->ivar; 19*f4a2713aSLionel Sambuc} 20*f4a2713aSLionel Sambuc@end 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambucvoid objc_assign_strongCast(id); 23*f4a2713aSLionel Sambucvoid __CFAssignWithWriteBarrier(void **location, void *value) { 24*f4a2713aSLionel Sambuc objc_assign_strongCast((id)value); 25*f4a2713aSLionel Sambuc} 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc// radar 7607605 28*f4a2713aSLionel Sambuc@interface RealClass { 29*f4a2713aSLionel Sambuc @public 30*f4a2713aSLionel Sambuc int f; 31*f4a2713aSLionel Sambuc} 32*f4a2713aSLionel Sambuc@end 33*f4a2713aSLionel Sambuc 34*f4a2713aSLionel Sambuc@implementation RealClass 35*f4a2713aSLionel Sambuc@end 36*f4a2713aSLionel Sambuc 37*f4a2713aSLionel Sambuc@interface Foo { 38*f4a2713aSLionel Sambuc id reserved; 39*f4a2713aSLionel Sambuc} 40*f4a2713aSLionel Sambuc@end 41*f4a2713aSLionel Sambuc 42*f4a2713aSLionel Sambuc@implementation Foo 43*f4a2713aSLionel Sambuc- (void)bar { 44*f4a2713aSLionel Sambuc ((RealClass*)reserved)->f = 99; 45*f4a2713aSLionel Sambuc} 46*f4a2713aSLionel Sambuc@end 47