aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/dc6.C
blob: b16c0b47ba0d34d30b5d06c9ff80bd5ae4af5768 (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
// { dg-do run { target c++11 } }

int a_ct;

struct A
{
  A(int i): i(i) { ++a_ct; }
  A(const A& a): i(a.i) { ++a_ct; }
  ~A() { --a_ct; }
  int i;
};

struct V
{
  V() { }
};

struct B: virtual V
{
  A a;
  B(A a): a(a) { }
  B(int i): B(A(i)) { }
};

struct C: B
{
  C(int i): B(i) { }
};

int main()
{
  {
    B b(42);
    C c(24);
    if (b.a.i != 42
	||c.a.i != 24)
      __builtin_abort ();
  }
  return a_ct;
}