summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/thunk3.C
blob: bfd68744ade6b33cd9445e4e877331598807565f (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
// PR c++/39106
// { dg-do compile }
// { dg-options "-O2" }

extern "C" void abort ();

struct A
{
  A (bool x = true);
};
class B
{
  virtual bool bar (A &, int) const =0;
};
class C : virtual public B
{
};
struct D : virtual public B
{
  bool bar (A &, int) const;
};
template <int N>
struct E : public D
{
  bool bar (A &x, int y) const
  {
    return baz().bar (x, y);
  }
  const D & baz () const;
};
extern template class E<0>;

void
foo ()
{
  try
  {
    A a;
    abort ();
  } catch (...)
  {
  }
  A b;
  E<0> c;
  c.bar (b, 3);
  E<0> d;
  d.bar (b, 3);
}