aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/covariant1.C
blob: e57cf4c6be040ee61412cb67ea732d9405b42919 (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
// PR c++/20206
// { dg-do run }
// { dg-options "-O0" }

void
bar (int x)
{
  asm ("" : : "g" (x));
}

struct S { S () {}; virtual ~S () {}; };
struct T { virtual T *foo (int) {}; };
struct V : virtual S, virtual T {};
struct V v;
struct U : public S, public T
{
  bool a;
  U () {}
  virtual ~U () {}
  virtual V *foo (int x)
  {
    switch (x)
      {
      case 12:
	break;
      case 9:
	bar (7);
	break;
      case 10:
	bar (12);
	break;
      case 4:
	bar (18);
	break;
      case 2:
	bar (26);
	break;
      }
    return &v;
  }
};
U u;

int
main ()
{
}