blob: 4e50ff142a8c1266708616540495118c6a57b1c2 [file] [log] [blame]
John McCall260611a2012-06-20 06:18:46 +00001// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp
Fariborz Jahanian5bfc5362010-01-25 20:50:02 +00002// RUN: FileCheck -check-prefix LP --input-file=%t-rw.cpp %s
3// radar 7575882
4
5@interface F {
6 int supervar;
7}
8@end
9
10@interface G : F {
11@public
12 int ivar;
13}
14@end
15
16@implementation G
17- (void)foo:(F *)arg {
18 int q = arg->supervar;
19 int v = ((G *)arg)->ivar;
20}
21@end
22
Fariborz Jahaniana5d5fbc2010-01-26 00:29:22 +000023void objc_assign_strongCast(id);
24void __CFAssignWithWriteBarrier(void **location, void *value) {
25 objc_assign_strongCast((id)value);
26}
27
Fariborz Jahanian2b9b0b22010-02-05 01:35:00 +000028// radar 7607605
29@interface RealClass {
30 @public
31 int f;
32}
33@end
34
35@implementation RealClass
36@end
37
38@interface Foo {
39 id reserved;
40}
41@end
42
43@implementation Foo
44- (void)bar {
45 ((RealClass*)reserved)->f = 99;
46}
47@end
48
Fariborz Jahanian5bfc5362010-01-25 20:50:02 +000049// CHECK-LP: ((struct G_IMPL *)arg)->ivar
50
Fariborz Jahaniana5d5fbc2010-01-26 00:29:22 +000051// CHECK-LP: objc_assign_strongCast((id)value)
Fariborz Jahanian2b9b0b22010-02-05 01:35:00 +000052
53// CHECK-LP: ((struct RealClass_IMPL *)((RealClass *)((struct Foo_IMPL *)self)->reserved))->f