aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/nested-func-1.m
blob: ae45fee8621cf4c354ed2ea13bd862366d48076b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* APPLE LOCAL file nested functions */
/* Test basic nested C function functionality within ObjC
   methods.  */
/* Contributed by Ziemowit Laski <zlaski@apple.com>.  */
/* { dg-options "-lobjc" } */
/* { dg-do run } */
#include <stdio.h>
#include <objc/objc.h>
#include <objc/Object.h>

int bappy (int (*blargh) (int a, int b, int c))
{
  return blargh (4, 7, 2) + 3;
}

@interface Foo: Object
+ (int)foo;
@end

@implementation Foo
+ (int)foo
{
  int blargh (int a, int b, int c)
  {
    return a * b + c;
  }
  return bappy (blargh);
}
@end

int main () 
{
  int f = [Foo foo];
  if (f != 33)
    abort ();

  return 0;
}