gcc/testsuite/g++.dg/ipa/pr46053.C
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-O -fipa-cp -fno-early-inlining" } */ |
| 3 | |
| 4 | extern "C" void abort (); |
| 5 | |
| 6 | struct A |
| 7 | { |
| 8 | virtual void foo () = 0; |
| 9 | }; |
| 10 | |
| 11 | struct B : A |
| 12 | { |
| 13 | virtual void foo () = 0; |
| 14 | }; |
| 15 | |
| 16 | struct C : A |
| 17 | { |
| 18 | }; |
| 19 | |
| 20 | struct D : C, B |
| 21 | { |
| 22 | int i; |
| 23 | D () : i(0xaaaa) {} |
| 24 | virtual void foo () |
| 25 | { |
| 26 | if (i != 0xaaaa) |
| 27 | abort(); |
| 28 | } |
| 29 | }; |
| 30 | |
| 31 | static inline void bar (B &b) |
| 32 | { |
| 33 | b.foo (); |
| 34 | } |
| 35 | |
| 36 | int main() |
| 37 | { |
| 38 | D d; |
| 39 | bar (d); |
| 40 | return 0; |
| 41 | } |