OSDN Git Service

2009-10-05 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / opt / covariant1.C
1 // PR c++/20206
2 // { dg-do run }
3 // { dg-options "-O0" }
4
5 void
6 bar (int x)
7 {
8   asm ("" : : "g" (x));
9 }
10
11 struct S { S () {}; virtual ~S () {}; };
12 struct T { virtual T *foo (int) {}; };
13 struct V : virtual S, virtual T {};
14 struct V v;
15 struct U : public S, public T
16 {
17   bool a;
18   U () {}
19   virtual ~U () {}
20   virtual V *foo (int x)
21   {
22     switch (x)
23       {
24       case 12:
25         break;
26       case 9:
27         bar (7);
28         break;
29       case 10:
30         bar (12);
31         break;
32       case 4:
33         bar (18);
34         break;
35       case 2:
36         bar (26);
37         break;
38       }
39     return &v;
40   }
41 };
42 U u;
43
44 int
45 main ()
46 {
47 }