summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/vbase1.C
blob: 4392784f94f8d309458d546d625033666cccf422 (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
// { dg-do run  }
// { dg-options "-w" }
// Origin: Mark Mitchell <mark@codesourcery.com>

int result;

struct A {
  A ();

  int i;
};

A* ap;

A::A ()
{
  ap = this;
}

struct B : virtual public A
{
  B ();
  ~B ();

  int j;
};

B::B () {
  if ((A*) this != ap)
    result = 1;
}

B::~B () {
  if ((A*) this != ap)
    result = 1;
}

struct C : public B {
};

struct D : public C, public B
{
};

int main ()
{
  {
    D d;
  }

  return result;
}