Debian Codegraph @

gcc/testsuite/g++.dg/init/ctor2.C

raw
1 // { dg-do run }
2
3 // Copyright (C) 2003 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 14 Mar 2003 <[email protected]>
5
6 // PR 9629. The vtable is not set up until the base initializers have
7 // run.
8
9 struct A {
10 static A *a;
11 A ();
12 };
13 A *A::a;
14 A::A () {a = this;}
15
16 struct B {
17 static A *a;
18 B (A *);
19 };
20 A *B::a;
21 B::B(A *a_) {a = a_;}
22
23 struct C : virtual public A, public B {
24 C();
25 };
26 C::C () : B(this) {}
27
28 struct D : virtual public C {};
29
30 int main()
31 {
32 new D();
33 return A::a != B::a;
34 }