2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / objc.dg / nested-func-1.m
blob7a182bd938e6872b964fd0646f392ab8095e6d9c
1 /* Test basic nested C function functionality within ObjC
2    methods.  */
3 /* Contributed by Ziemowit Laski <zlaski@apple.com>.  */
4 /* { dg-options "-lobjc" } */
5 /* { dg-do run } */
6 #include <stdio.h>
7 #include <objc/objc.h>
8 #include <objc/Object.h>
10 int bappy (int (*blargh) (int a, int b, int c))
12   return blargh (4, 7, 2) + 3;
15 @interface Foo: Object
16 + (int)foo;
17 @end
19 @implementation Foo
20 + (int)foo
22   int blargh (int a, int b, int c)
23   {
24     return a * b + c;
25   }
26   return bappy (blargh);
28 @end
30 int main () 
32   int f = [Foo foo];
33   if (f != 33)
34     abort ();
36   return 0;