1 /* Check if sending messages to super does not interfere with sending messages
3 /* Contributed by Ziemowit Laski <zlaski@apple.com>. */
4 /* { dg-options "" } */
6 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
8 #include "../objc-obj-c++-shared/Object1.h"
10 extern void abort(void);
11 #define CHECK_IF(expr) if(!(expr)) abort()
13 @interface Base: Object
15 - (int) instance_func1;
18 @interface Derived: Base
22 @interface Derived (Categ)
23 - (int) instance_func1;
27 + (int) class_func1 { return 234; }
28 - (int) instance_func1 { return 345; }
31 @implementation Derived
33 int i = [super class_func1];
34 i += [Base class_func1];
39 @implementation Derived (Categ)
40 - (int) instance_func1 {
41 int i = [super instance_func1];
42 i += [Base class_func1]; /* { dg-bogus "invalid receiver type" } */
48 Base *base = [[Base alloc] init]; /* { dg-bogus "invalid receiver type" } */
49 Derived *derived = [[Derived alloc] init];
50 CHECK_IF([Base class_func1] == 234); /* { dg-bogus "invalid receiver type" } */
51 CHECK_IF([Derived class_func1] == 234 + 234);
52 CHECK_IF([base instance_func1] == 345);
53 CHECK_IF([derived instance_func1] == 234 + 345);
57 #include "../objc-obj-c++-shared/Object1-implementation.h"