aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/fpointer.cc
blob: 007ea39307766d6661125fe5c77adfe132525b37 (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
#include "stdio.h"

int foo(){
  return 11;
}

int bar(){
  return 12;
}

int bar(int){
  printf ("bar(int)\n");
  return 13;
}

int bar(char){
  printf ("bar(char)\n");
  return 14;
}

int (*p1)() = &foo;
int (*p2)() = &bar;
int (*p[2])() = {p1,p2};

int (*p3)(int) = &bar;
int (*p4)(char) = &bar;

int main ()
{
  p1 ();
  p2 ();

  p[0]();
  p[1]();

  p3 ('a');
  p4 (1);

  return 0;
}