OSDN Git Service

* gcc.dg/20001023-1.c, gcc.dg/20001108-1.c, gcc.dg/20001117-1.c,
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / objc.dg / nested-func-1.m
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 <stdlib.h>
8 #include <objc/objc.h>
9 #include <objc/Object.h>
10
11 int bappy (int (*blargh) (int a, int b, int c))
12 {
13   return blargh (4, 7, 2) + 3;
14 }
15
16 @interface Foo: Object
17 + (int)foo;
18 @end
19
20 @implementation Foo
21 + (int)foo
22 {
23   int blargh (int a, int b, int c)
24   {
25     return a * b + c;
26   }
27   return bappy (blargh);
28 }
29 @end
30
31 int main () 
32 {
33   int f = [Foo foo];
34   if (f != 33)
35     abort ();
36
37   return 0;
38 }