gcc/testsuite/gnat.dg/expr_func9.adb
raw| 1 | -- { dg-do compile } |
| 2 | -- { dg-options "-gnatws" } |
| 3 | |
| 4 | procedure Expr_Func9 is |
| 5 | |
| 6 | type Root is interface; |
| 7 | |
| 8 | type Child1 is new Root with null record; |
| 9 | |
| 10 | type Child2 is new Root with record |
| 11 | I2 : Integer; |
| 12 | end record; |
| 13 | |
| 14 | function Create (I : Integer) return Child2 is (I2 => I); |
| 15 | |
| 16 | I : Root'Class := |
| 17 | (if False |
| 18 | then Child1'(null record) |
| 19 | else |
| 20 | Create (1)); |
| 21 | |
| 22 | begin |
| 23 | null; |
| 24 | end Expr_Func9; |