32 lines · plain
1// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-runtime=macosx-fragile-10.5 %s -fsyntax-only2 3@interface Test {4 double a;5}6@end7@implementation Test8@end9@interface TestObject : Test {10@public11 float bar;12 int foo;13}14@end15@implementation TestObject16@end17struct wibble {18 @defs(TestObject)19};20 21extern void *malloc(__typeof__(sizeof(0)));22extern int printf(const char *, ...);23 24int main(void)25{26 TestObject * a = (id)malloc(100);27 a->foo = 12;28 printf("12: %d\n", ((struct wibble*)a)->foo);29 printf("%d: %d\n", ((char*)&(((struct wibble*)a)->foo)) - (char*)a, ((char*)&(a->foo)) - (char*)a);30 return 0;31}32