gcc/testsuite/g++.dg/opt/rtti2.C
raw| 1 | // { dg-do compile } |
| 2 | // { dg-options "-O2" } |
| 3 | // We used to ICE in compare_values as the types for a comparison |
| 4 | // were not the same kind of types. |
| 5 | |
| 6 | struct class1 |
| 7 | { |
| 8 | virtual ~class1 (); |
| 9 | }; |
| 10 | struct class2 : class1 { }; |
| 11 | |
| 12 | void f(class1 * oo) |
| 13 | { |
| 14 | class2 * oj = dynamic_cast <class2 *>(oo) ; |
| 15 | if (oj) |
| 16 | delete oo; |
| 17 | } |