1 /* Check if sending messages to super does not interfere with sending messages
3 /* Contributed by Ziemowit Laski <zlaski@apple.com>. */
5 /* { dg-options "-lobjc" } */
7 #include <objc/Object.h>
9 extern void abort(void);
10 #define CHECK_IF(expr) if(!(expr)) abort()
12 @interface Base: Object
14 - (int) instance_func1;
17 @interface Derived: Base
21 @interface Derived (Categ)
22 - (int) instance_func1;
26 + (int) class_func1 { return 234; }
27 - (int) instance_func1 { return 345; }
30 @implementation Derived
32 int i = [super class_func1];
33 i += [Base class_func1];
38 @implementation Derived (Categ)
39 - (int) instance_func1 {
40 int i = [super instance_func1];
41 i += [Base class_func1]; /* { dg-bogus "invalid receiver type" } */
47 Base *base = [[Base alloc] init]; /* { dg-bogus "invalid receiver type" } */
48 Derived *derived = [[Derived alloc] init];
49 CHECK_IF([Base class_func1] == 234); /* { dg-bogus "invalid receiver type" } */
50 CHECK_IF([Derived class_func1] == 234 + 234);
51 CHECK_IF([base instance_func1] == 345);
52 CHECK_IF([derived instance_func1] == 234 + 345);