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" } { "" } } */
7 #include "../objc-obj-c++-shared/Object1.h"
9 extern void abort(void);
10 #define CHECK_IF(expr) if(!(expr)) abort()
12 @interface Int1: Object
17 @interface Int2: Object
23 + (int) classMeth { return 345; }
24 - (int) instanceMeth { return 697; }
28 + (int) classMeth { return 1345; }
29 - (int) instanceMeth { return 1697; }
32 typedef Int1 Int1Typedef;
33 @compatibility_alias Int1Alias Int1Typedef;
34 @compatibility_alias Int2Alias Int2;
35 typedef Int2Alias Int2Typedef;
38 Int1Alias *int1alias = [[Int1Typedef alloc] init];
39 Int2Typedef *int2typedef = [[Int2Alias alloc] init];
41 CHECK_IF([Int1Typedef classMeth] == 345 && [Int2Alias classMeth] == 1345);
42 CHECK_IF([int1alias instanceMeth] == 697 && [int2typedef instanceMeth] == 1697);
43 CHECK_IF([(Int2Typedef *)int1alias instanceMeth] == 697);
44 CHECK_IF([(Int1Alias *)int2typedef instanceMeth] == 1697);
48 #include "../objc-obj-c++-shared/Object1-implementation.h"