1/* Testcase for PR 40323.  */
2/* { dg-do compile } */
3/* { dg-options "-fno-early-inlining"  } */
4/* { dg-add-options bind_pic_locally } */
5
6extern void do_something (const char *, int);
7
8class Parent
9{
10private:
11  const char *data;
12
13public:
14  Parent (const char *d) : data(d)
15  {}
16
17  int funcOne (int delim) const;
18};
19
20class AnotherParent
21{
22private:
23  double d;
24public:
25  AnotherParent (void) : d(0)
26  {}
27};
28
29
30class Child : public AnotherParent, Parent
31{
32private:
33  int zzz;
34public:
35  Child (const char *d) : Parent(d)
36  {}
37};
38
39
40int Parent::funcOne (int delim) const
41{
42  int i;
43  for (i = 0; i < delim; i++)
44    do_something(data, i);
45
46  return 1;
47}
48
49int docalling (int (Child::* f)(int delim) const)
50{
51  Child S ("muhehehe");
52
53  return (S.*f)(4);
54}
55
56typedef int (Parent::* my_mp_type)(int delim);
57
58int main (int argc, char *argv[])
59{
60  int i;
61  int (Parent::* f)(int ) const;
62  int (Child::* g)(int ) const;
63
64  f = &Parent::funcOne;
65  g = (int (Child::* )(int) const) f;
66  i = docalling (g);
67  return i;
68}
69