1/* Check if array and function parameters get decayed to pointers as
2   they should.  */
3/* { dg-do run } */
4/* { dg-options "-O2" } */
5/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
6
7#include "../objc-obj-c++-shared/TestsuiteObject.m"
8#include <string.h>
9#include <stdlib.h>
10
11static char global_buf[20];
12
13char *strcpy_like_callee(const char *s) {
14  strcpy(global_buf, s);
15  return global_buf;
16}
17
18typedef char io_string_t[512];
19typedef char *(func_type)(const char *);
20
21@interface DeviceObject: TestsuiteObject
22- (void) func:(func_type)func stucPathInIORegistry:(io_string_t)ioRegPath;
23@end
24@implementation DeviceObject
25- (void) func:(func_type)func stucPathInIORegistry:(io_string_t)ioRegPath
26{
27    func(ioRegPath);
28}
29@end
30
31int main (void) {
32  io_string_t my_string;
33  DeviceObject *obj = [DeviceObject new];
34
35  strcpy (my_string, "Hello!");
36  strcpy (global_buf, "Good-bye!");
37
38  [obj func:strcpy_like_callee stucPathInIORegistry:my_string];
39
40  if (strcmp (global_buf, "Hello!"))
41    abort ();
42
43  return 0;
44}
45