xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/at-defs.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-runtime=macosx-fragile-10.5 %s -fsyntax-only
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuc@interface Test {
4*f4a2713aSLionel Sambuc	double a;
5*f4a2713aSLionel Sambuc}
6*f4a2713aSLionel Sambuc@end
7*f4a2713aSLionel Sambuc@implementation Test
8*f4a2713aSLionel Sambuc@end
9*f4a2713aSLionel Sambuc@interface TestObject : Test {
10*f4a2713aSLionel Sambuc@public
11*f4a2713aSLionel Sambuc  float bar;
12*f4a2713aSLionel Sambuc  int foo;
13*f4a2713aSLionel Sambuc}
14*f4a2713aSLionel Sambuc@end
15*f4a2713aSLionel Sambuc@implementation TestObject
16*f4a2713aSLionel Sambuc@end
17*f4a2713aSLionel Sambucstruct wibble {
18*f4a2713aSLionel Sambuc  @defs(TestObject)
19*f4a2713aSLionel Sambuc};
20*f4a2713aSLionel Sambuc
21*f4a2713aSLionel Sambuc
22*f4a2713aSLionel Sambucint main(void)
23*f4a2713aSLionel Sambuc{
24*f4a2713aSLionel Sambuc	TestObject * a = (id)malloc(100);
25*f4a2713aSLionel Sambuc	a->foo = 12;
26*f4a2713aSLionel Sambuc	printf("12: %d\n", ((struct wibble*)a)->foo);
27*f4a2713aSLionel Sambuc	printf("%d: %d\n", ((char*)&(((struct wibble*)a)->foo)) - (char*)a, ((char*)&(a->foo)) - (char*)a);
28*f4a2713aSLionel Sambuc	return 0;
29*f4a2713aSLionel Sambuc}
30