gcc/testsuite/g++.dg/torture/pr94202.C
raw| 1 | // { dg-additional-options "-w" } |
| 2 | struct S1 { |
| 3 | virtual ~S1(); |
| 4 | virtual void v(); |
| 5 | }; |
| 6 | struct S2: S1 {}; |
| 7 | struct S3: S1, S2 { void v(); }; |
| 8 | struct S4: S3 { void v(); }; |
| 9 | void S4::v() { S3::v(); } |
| 10 | struct R { |
| 11 | S1 * m; |
| 12 | void f(S2 * x) { |
| 13 | static_cast<S1 *>(x)->v(); |
| 14 | x->v(); |
| 15 | m = x; |
| 16 | } |
| 17 | }; |
| 18 | void f() { |
| 19 | R r; |
| 20 | r.f(new S4); |
| 21 | r.f(new S3); |
| 22 | } |