summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc/execute/nested-func-1.m
blob: a4c9a561968a43cdf9344ab029e75578291c64ba (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
/* Test basic nested C function functionality within ObjC
   methods.  */
/* Contributed by Ziemowit Laski <zlaski@apple.com>.  */
#include <stdio.h>
#include <stdlib.h>
#import "../../objc-obj-c++-shared/Object1.h"
#include <objc/objc.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;
}