aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.jason/thunk2.C
blob: a52ec2e865e6c53310605e6fd44b1cdac36403df (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
// { dg-do run { xfail m68k-motorola-sysv m88k-motorola-sysv3 } }
// { dg-options "-fPIC" }
// Test that non-variadic function calls using thunks and PIC work right.

struct A {
  void* p;
  A (void* q): p (q) { }
  A (const A& a): p (a.p) { }
};

class CBase {
public:
  virtual void BaseFunc();
};

class MMixin {
public:
   virtual A MixinFunc(int arg, A arg2) = 0;
};

class CExample : public CBase, public MMixin {
public:
   A MixinFunc(int arg, A arg2);
};

void CBase::BaseFunc()
{
}

A CExample::MixinFunc(int arg, A arg2)
{
  if (arg != 1 || arg2.p != 0)
    return 0;
  return this;
}

void* test(MMixin& anExample)
{
  return anExample.MixinFunc(1,A(0)).p;
}

main ()
{
  CExample c;

  if (test(c) != &c)
    return 1;
}