aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8.1/gcc/testsuite/g++.dg/inherit/thunk10.C
blob: 702067749fa28731034c88a222fb4c2b81c8398e (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* { dg-options "-mthumb" { target arm*-*-* } } */
/* { dg-do run } */
/* { dg-timeout 100 } */

/* PR middle-end/39378 */
/* Check if the thunk target function is emitted correctly. */
class B1
{
public:
  virtual int foo1(void);
  int b1;
};

class B2
{
public:
  virtual int foo2 (void);
  int b2;
};

class D : public B1, public B2
{
  int foo1(void);
  int foo2(void);
  int d;
};

int B1::foo1(void)
{
  return 3;
}

int B2::foo2(void)
{
  return 4;
}

int D::foo1(void)
{
  return 1;
}

int D::foo2(void)
{
  return 2;
}

__attribute__((noinline)) int test(B2* bp)
{
  return bp->foo2();
}

int main()
{
  B2 *bp = new D();
  if (test(bp) == 2)
    return 0;
  else
    return 1;
}