1 /* Test for handling of function pointer ivars */
4 #include <objc/Object.h>
6 extern int strcmp(const char *, const char *);
7 extern void abort(void);
8 #define CHECK_IF(expr) if(!(expr)) abort()
10 typedef float (*floatfunc)(float, float);
12 @interface MyObject : Object
15 int (*ivar)(int, int, int);
21 int foo(int a, int b, int c) {
25 float bar(float a, float b) {
29 @implementation MyObject
40 MyObject *obj = [[MyObject alloc] init];
41 const char *enc = @encode(MyObject);
43 CHECK_IF(obj->ivar(4, 5, 6) == 15);
44 CHECK_IF(obj->ffunc(34.0, 45.0) == 34.0 * 45.0);
45 CHECK_IF(!strcmp(enc, "{MyObject=#^?^?}"));