1 /* Test for sending messages to aliased classes (and instances thereof). */
2 /* Author: Ziemowit Laski <zlaski@apple.com>. */
3 /* { dg-options "" } */
5 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
6 #include "../objc-obj-c++-shared/TestsuiteObject.m"
9 #define CHECK_IF(expr) if(!(expr)) abort()
11 @interface Int1: TestsuiteObject
16 @interface Int2: TestsuiteObject
22 + (int) classMeth { return 345; }
23 - (int) instanceMeth { return 697; }
27 + (int) classMeth { return 1345; }
28 - (int) instanceMeth { return 1697; }
31 typedef Int1 Int1Typedef;
32 @compatibility_alias Int1Alias Int1Typedef;
33 @compatibility_alias Int2Alias Int2;
34 typedef Int2Alias Int2Typedef;
37 Int1Alias *int1alias = [[Int1Typedef alloc] init];
38 Int2Typedef *int2typedef = [[Int2Alias alloc] init];
40 CHECK_IF([Int1Typedef classMeth] == 345 && [Int2Alias classMeth] == 1345);
41 CHECK_IF([int1alias instanceMeth] == 697 && [int2typedef instanceMeth] == 1697);
42 CHECK_IF([(Int2Typedef *)int1alias instanceMeth] == 697);
43 CHECK_IF([(Int1Alias *)int2typedef instanceMeth] == 1697);