| 1 |
/* Test basic nested C function functionality within ObjC |
| 2 |
methods. */ |
| 3 |
/* Contributed by Ziemowit Laski <[email protected]>. */ |
| 4 |
#include <stdio.h> |
| 5 |
#include <stdlib.h> |
| 6 |
#import "../../objc-obj-c++-shared/TestsuiteObject.m" |
| 7 |
#include <objc/objc.h> |
| 8 |
|
| 9 |
int bappy (int (*blargh) (int a, int b, int c)) |
| 10 |
{ |
| 11 |
return blargh (4, 7, 2) + 3; |
| 12 |
} |
| 13 |
|
| 14 |
@interface Foo: TestsuiteObject |
| 15 |
+ (int)foo; |
| 16 |
@end |
| 17 |
|
| 18 |
@implementation Foo |
| 19 |
+ (int)foo |
| 20 |
{ |
| 21 |
int blargh (int a, int b, int c) |
| 22 |
{ |
| 23 |
return a * b + c; |
| 24 |
} |
| 25 |
return bappy (blargh); |
| 26 |
} |
| 27 |
@end |
| 28 |
|
| 29 |
int main () |
| 30 |
{ |
| 31 |
int f = [Foo foo]; |
| 32 |
if (f != 33) |
| 33 |
abort (); |
| 34 |
|
| 35 |
return 0; |
| 36 |
} |