111
|
1 /* Check if sending messages to super does not interfere with sending messages
|
|
2 to classes. */
|
|
3 /* Contributed by Ziemowit Laski <zlaski@apple.com>. */
|
|
4 /* { dg-options "" } */
|
|
5 /* { dg-do run } */
|
|
6 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
|
|
7
|
|
8 #include "../objc-obj-c++-shared/TestsuiteObject.m"
|
|
9
|
|
10 extern void abort(void);
|
|
11 #define CHECK_IF(expr) if(!(expr)) abort()
|
|
12
|
|
13 @interface Base: TestsuiteObject
|
|
14 + (int) class_func1;
|
|
15 - (int) instance_func1;
|
|
16 @end
|
|
17
|
|
18 @interface Derived: Base
|
|
19 + (int) class_func1;
|
|
20 @end
|
|
21
|
|
22 @interface Derived (Categ)
|
|
23 - (int) instance_func1;
|
|
24 @end
|
|
25
|
|
26 @implementation Base
|
|
27 + (int) class_func1 { return 234; }
|
|
28 - (int) instance_func1 { return 345; }
|
|
29 @end
|
|
30
|
|
31 @implementation Derived
|
|
32 + (int) class_func1 {
|
|
33 int i = [super class_func1];
|
|
34 i += [Base class_func1];
|
|
35 return i;
|
|
36 }
|
|
37 @end
|
|
38
|
|
39 @implementation Derived (Categ)
|
|
40 - (int) instance_func1 {
|
|
41 int i = [super instance_func1];
|
|
42 i += [Base class_func1]; /* { dg-bogus "invalid receiver type" } */
|
|
43 return i;
|
|
44 }
|
|
45 @end
|
|
46
|
|
47 int main(void) {
|
|
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);
|
|
54 return 0;
|
|
55 }
|
|
56
|