1 /* Test for handling of function pointer ivars */
3 /* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
5 #include "../objc-obj-c++-shared/TestsuiteObject.m"
7 extern int strcmp(const char *, const char *);
8 extern void abort(void);
9 #define CHECK_IF(expr) if(!(expr)) abort()
11 typedef float (*floatfunc)(float, float);
13 @interface MyObject : TestsuiteObject
16 int (*ivar)(int, int, int);
22 int foo(int a, int b, int c) {
26 float bar(float a, float b) {
30 @implementation MyObject
41 MyObject *obj = [[MyObject alloc] init];
42 const char *enc = @encode(MyObject);
44 CHECK_IF(obj->ivar(4, 5, 6) == 15);
45 CHECK_IF(obj->ffunc(34.0, 45.0) == 34.0 * 45.0);
46 CHECK_IF(!strcmp(enc, "{MyObject=#^?^?}"));