Debian Codegraph @

gcc/testsuite/g++.dg/ipa/pr46984.C

raw
1 // { dg-options "-O -fipa-cp -fno-early-inlining -flto" }
2 // { dg-do run }
3 // { dg-require-effective-target lto }
4
5 extern "C" void abort ();
6
7 class A
8 {
9 public:
10 virtual void foo () {abort();}
11 };
12
13 class B : public A
14 {
15 public:
16 int z;
17 virtual void foo () {abort();}
18 };
19
20 class C : public A
21 {
22 public:
23 void *a[32];
24 unsigned long b;
25 long c[32];
26
27 virtual void foo () {abort();}
28 };
29
30 class D : public C, public B
31 {
32 public:
33 D () : C(), B()
34 {
35 int i;
36 for (i = 0; i < 32; i++)
37 {
38 a[i] = (void *) 0;
39 c[i] = 0;
40 }
41 b = 0xaaaa;
42 }
43
44 virtual void foo ();
45 };
46
47 void D::foo()
48 {
49 if (b != 0xaaaa)
50 abort();
51 }
52
53 static inline void bar (B &b)
54 {
55 b.foo ();
56 }
57
58 int main()
59 {
60 D d;
61 bar (d);
62 return 0;
63 }