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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 699 jeremybenn
// { dg-do run  }
2
extern "C" int printf(const char *, ...);
3
void *vp;
4
int fail = 0;
5
 
6
class Foo {
7
public:
8
   virtual void setName() {
9
     printf("Foo at %x\n", this);
10
     if (vp != (void*)this)
11
       fail = 1;
12
   }
13
};
14
 
15
class Bar : public Foo {
16
public:
17
  virtual void init(int argc, char **argv) {
18
    printf("Bar's Foo at %x\n", (Foo*)this);
19
    vp = (void*)(Foo*)this;
20
    setName();
21
  }
22
};
23
 
24
class Barf : virtual public Bar {
25
public:
26
  virtual void init(int argc, char **argv) { Bar::init(argc, argv); }
27
};
28
 
29
class Baz : virtual public Bar, virtual public Barf {
30
public:
31
  virtual void init(int argc, char **argv) { Barf::init(argc, argv); }
32
};
33
 
34
Bar *theBar = new Baz();
35
 
36
int main(int argc, char **argv) {
37
   theBar->init(argc, argv);
38
   return fail;
39
}

powered by: WebSVN 2.1.0

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