gcc/testsuite/gnat.dg/controlled5_pkg.adb
raw| 1 | with Ada.Tags; |
| 2 | |
| 3 | package body Controlled5_Pkg is |
| 4 | |
| 5 | type Child is new Root with null record; |
| 6 | |
| 7 | function Dummy (I : Integer) return Root'Class is |
| 8 | A1 : T_Root_Class := new Child; |
| 9 | My_Var : Root'Class := A1.all; |
| 10 | begin |
| 11 | if I = 0 then |
| 12 | return My_Var; |
| 13 | else |
| 14 | return Dummy (I - 1); |
| 15 | end if; |
| 16 | end Dummy; |
| 17 | |
| 18 | end Controlled5_Pkg; |