gcc/testsuite/g++.dg/ipa/pr59737.C
raw| 1 | // PR middle-end/59737 |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-O2" } |
| 4 | |
| 5 | struct A |
| 6 | { |
| 7 | virtual void foo (int &x); |
| 8 | friend void |
| 9 | operator>> (int &x, A &y) |
| 10 | { |
| 11 | y.foo (x); |
| 12 | } |
| 13 | }; |
| 14 | |
| 15 | struct B : public A |
| 16 | { |
| 17 | void foo (int &x); |
| 18 | }; |
| 19 | |
| 20 | struct F : public B |
| 21 | { |
| 22 | void foo (int &x); |
| 23 | }; |
| 24 | |
| 25 | struct G : public F |
| 26 | { |
| 27 | void foo (int &); |
| 28 | }; |
| 29 | |
| 30 | struct C : A |
| 31 | { |
| 32 | void foo (int &); |
| 33 | struct H : public G |
| 34 | { |
| 35 | void foo (int &); |
| 36 | }; |
| 37 | struct D : A |
| 38 | { |
| 39 | H d; |
| 40 | }; |
| 41 | }; |
| 42 | |
| 43 | void |
| 44 | C::foo (int &x) |
| 45 | { |
| 46 | D a; |
| 47 | x >> a.d; |
| 48 | } |