OSDN Git Service

2005-08-13 Andrew Pinski <pinskia@physics.uc.edu>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc / execute / nested-func-1.m
1 /* Test basic nested C function functionality within ObjC
2    methods.  */
3 /* Contributed by Ziemowit Laski <zlaski@apple.com>.  */
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <objc/objc.h>
7 #include <objc/Object.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: Object
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 }