aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/pr71387.C
blob: 56f4a4d38b4c79b2c9e18f869adfcbb1e8e9059c (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
// PR middle-end/71387
// { dg-do compile }
// { dg-options "-Og" }

struct A
{
  A ();
  inline A (const A &);
};

struct B
{
  explicit B (unsigned long) : b(0), c(1) {}
  A a;
  unsigned long b;
  int c;
};

struct C {};

struct D
{
  explicit D (const C *) {}
};

struct E : public D
{
  E (const C *x) : D(x) {}
  virtual A foo () const = 0;
  virtual A bar () const = 0;
};

struct F : public B
{
  inline void baz ();
  F (const E *);
  const E *f;
};

inline void
F::baz ()
{
  if (b == 0)
    a = f->bar ();
  else
    a = f->foo ();
}

F::F (const E *) : B(4)
{
  baz ();
}