aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/pr35616.c
blob: ad2c9e99e99d41ab18dbaf697bb07a59361e63df (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
39
40
41
42
43
/* { dg-do run } */
/* { dg-options "-O2" } */
typedef void (*listener_fun)(
        int a,
        int b,
        int c);

struct data_t
{
  int a;

  listener_fun listener;

  int b;
  int c;
  int d;
};

extern void abort(void);
void function_calling_listener (struct data_t data);

void function_calling_listener (struct data_t data)
{
  data.listener(data.a, data.c, data.d);
}

void my_listener(int a, int b, int c)
{
  if (a != 42 || b != 44 || c != 45)
    abort ();
}

int main()
{
  struct data_t d;
  d.a = 42;
  d.b = 43;
  d.c = 44;
  d.d = 45;
  d.listener = my_listener;
  function_calling_listener (d);
  return 0;
}