OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [torture/] [pr40323.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
/* Testcase for PR 40323.  */
2
/* { dg-do compile } */
3
/* { dg-options "-fno-early-inlining"  } */
4
/* { dg-add-options bind_pic_locally } */
5
 
6
extern void do_something (const char *, int);
7
 
8
class Parent
9
{
10
private:
11
  const char *data;
12
 
13
public:
14
  Parent (const char *d) : data(d)
15
  {}
16
 
17
  int funcOne (int delim) const;
18
};
19
 
20
class AnotherParent
21
{
22
private:
23
  double d;
24
public:
25
  AnotherParent (void) : d(0)
26
  {}
27
};
28
 
29
 
30
class Child : public AnotherParent, Parent
31
{
32
private:
33
  int zzz;
34
public:
35
  Child (const char *d) : Parent(d)
36
  {}
37
};
38
 
39
 
40
int 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
 
49
int docalling (int (Child::* f)(int delim) const)
50
{
51
  Child S ("muhehehe");
52
 
53
  return (S.*f)(4);
54
}
55
 
56
typedef int (Parent::* my_mp_type)(int delim);
57
 
58
int 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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.