summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/init/ctor7.C
blob: 3378a150e2e0267d09fbe35e5a6dcdb005fab5c9 (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
// { dg-do run }

// Copyright (C) 2005 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 13 Oct 2005 <nathan@codesourcery.com>

// PR 23984:ICE
// Origin:  Andrew Pinski pinskia@gcc.gnu.org

struct B
{
  virtual void Foo ();
};

void B::Foo ()
{
}

struct D : virtual B
{
};

struct E
{
  B *ptr;
  
  E (B *);
};

static B *ptr;

E::E (B *ptr_)
  :ptr (ptr_)
{
}

struct G : D, E
{
  G ();
};

G::G ()
  : E (this)
{
}

int main ()
{
  G object;

  return object.ptr != &object;
}