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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.old-deja/] [g++.jason/] [thunk2.C] - Blame information for rev 699

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do run { target fpic } }
2
// { dg-options "-fPIC" }
3
// { dg-skip-if "requires unsupported run-time relocation" { spu-*-* } { "*" } { "" } }
4
// Test that non-variadic function calls using thunks and PIC work right.
5
 
6
struct A {
7
  void* p;
8
  A (void* q): p (q) { }
9
  A (const A& a): p (a.p) { }
10
};
11
 
12
class CBase {
13
public:
14
  virtual void BaseFunc();
15
};
16
 
17
class MMixin {
18
public:
19
   virtual A MixinFunc(int arg, A arg2) = 0;
20
};
21
 
22
class CExample : public CBase, public MMixin {
23
public:
24
   A MixinFunc(int arg, A arg2);
25
};
26
 
27
void CBase::BaseFunc()
28
{
29
}
30
 
31
A CExample::MixinFunc(int arg, A arg2)
32
{
33
  if (arg != 1 || arg2.p != 0)
34
    return 0;
35
  return this;
36
}
37
 
38
void* test(MMixin& anExample)
39
{
40
  return anExample.MixinFunc(1,A(0)).p;
41
}
42
 
43
main ()
44
{
45
  CExample c;
46
 
47
  if (test(c) != &c)
48
    return 1;
49
}

powered by: WebSVN 2.1.0

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