summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.mike/net15.C
blob: 4d7129ee9e7229b1b33916b7663a18f447821870 (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
// { dg-do run  }
// InterViews (ibuild) requires this to work.

extern "C" void exit(int);

void *old;

class c1
{
  int i;
public:
  c1 () {}
};

class c2
{
  int j;
public:
  c2 () {}
};

class c3 : public c1, public c2
{
public:
  c3 ()
    {
      old = this;
      // printf("new object c3 at %x\n", (int)this); }
    }
};

c2* f ()
{
  c2* n = new c3 ();
  // printf ("new object c3 casted to c2 at %x\n", (int)n);
  return n;
}

int main ()
{
  c3* o = (c3*)f ();
  // printf("new object c3, upcasted from c2 at %x\n", (int)o);
  // if old and o are not the same, fail the test case.
  if (old != o)
    exit(1);
  return 0;
}